|
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. | |
Public Member Functions inherited from albert::TriggerQueryHandler | |
| virtual QString | synopsis (const QString &query) const |
| Returns the input hint for the given query. | |
| virtual bool | allowTriggerRemap () const |
Returns true if the user is allowed to set a custom trigger, otherwise returns false. | |
| virtual QString | defaultTrigger () const |
| Returns the default trigger. | |
| virtual void | setTrigger (const QString &trigger) |
| Notifies that the user-defined trigger has changed to trigger. | |
| virtual bool | supportsFuzzyMatching () const |
Returns true if the handler supports error tolerant matching, otherwise returns false. | |
| virtual void | setFuzzyMatching (bool enabled) |
| Sets the fuzzy matching mode to enabled. | |
| void | applyUsageScore (std::vector< RankItem > &rank_items) |
| Modifies the score of rank_items to reflect the users usage history. | |
Public Member Functions inherited from albert::Extension | |
| 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 | |
Protected Member Functions inherited from albert::TriggerQueryHandler | |
| ~TriggerQueryHandler () override | |
Protected Member Functions inherited from albert::Extension | |
| 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.