Albert
|
#include <albert/globalqueryhandler.h>
Abstract global query handler.
A functional query handler returning scored items. Applicable for the global search. Use this if you want your results show up in the global search.
By design choice every global query handler should also provide a trigger handler. To enforce this GlobalQueryHandler inherits TriggerQueryHandler and implements the TriggerQueryHandler::handleTriggerQuery.
Public Member Functions | |
virtual std::vector< RankItem > | handleGlobalQuery (const Query &query)=0 |
Returns a list of items matching the query or all items if the query is empty. | |
virtual std::vector< std::shared_ptr< Item > > | handleEmptyQuery () |
Returns a list of special items that should show up on an emtpy query. | |
void | handleTriggerQuery (Query &query) override |
Calls handleGlobalQuery, applyUsageScore, sorts and adds the items to query. | |
![]() | |
virtual QString | synopsis (const QString &query) const |
The synopsis, displayed on empty query. | |
virtual bool | allowTriggerRemap () const |
Enable user remapping of the trigger. | |
virtual QString | defaultTrigger () const |
The default (not user defined) trigger. | |
virtual void | setTrigger (const QString &) |
Setter for the user defined trigger. | |
virtual bool | supportsFuzzyMatching () const |
Fuzzy matching capability. | |
virtual void | setFuzzyMatching (bool enabled) |
Fuzzy matching behavior. | |
void | applyUsageScore (std::vector< RankItem > &rank_items) |
Modifies the score of rank_items to reflect the users usage history. | |
![]() | |
virtual QString | id () const =0 |
The identifier of this extension. | |
virtual QString | name () const =0 |
Pretty, human readable name. | |
virtual QString | description () const =0 |
Brief description of this extension. | |
Protected Member Functions | |
~GlobalQueryHandler () override | |
![]() | |
~TriggerQueryHandler () override | |
![]() | |
virtual | ~Extension () |
|
overrideprotected |
|
virtual |
Returns a list of special items that should show up on an emtpy query.
Empty patterns match everything. For triggered queries this is desired and by design lots of handlers relay the handleTriggerQuery to handleGlobalQuery. For global queries this leads to an expensive query execution on empty queries. Therefore the empty global query is not executed. This function allows dedicated empty global query handling.
|
pure virtual |
Returns a list of items matching the query or all items if the query is empty.
The match score should make sense and often (if not always) be the fraction of matched chars (legth of query string / length of item title). The empty query should return all items with a score of 0.
Implemented in albert::util::IndexQueryHandler.
|
overridevirtual |
Calls handleGlobalQuery, applyUsageScore, sorts and adds the items to query.
Implements albert::TriggerQueryHandler.