|
Albert
|
#include <albert/rankedqueryhandler.h>
Usage-ranked query handler.
Convenience base class for triggered query handlers that return a complete set of match-scored items eagerly. rankItems is executed in a worker thread, allowing CPU-bound work without blocking the main thread. The provided match scores will be combined with the usage-based scoring weighted by user configuration. Finally the items will be yielded lazily in order of their final score.
Public Member Functions | |
| virtual std::vector< RankItem > | rankItems (QueryContext &context)=0 |
| Returns a list of scored matches for context. | |
| ItemGenerator | items (QueryContext &context) override |
| Yields result of rankItems for context usage scored and lazily sorted. | |
Public Member Functions inherited from albert::QueryHandler | |
| 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 bool | supportsFuzzyMatching () const |
Returns true if the handler supports fuzzy matching, otherwise returns false. | |
Public Member Functions inherited from albert::Extension | |
| virtual QString | id () const =0 |
| Returns the extension identifier. | |
| virtual QString | name () const =0 |
| Returns the pretty, human readable extension name. | |
| virtual QString | description () const =0 |
| Returns the brief extension description. | |
Static Public Member Functions | |
| static ItemGenerator | lazySort (std::vector< RankItem > rank_items) |
| Yields rank_items lazily sorted. | |
Protected Member Functions | |
| ~RankedQueryHandler () override | |
| Destructs the handler. | |
Protected Member Functions inherited from albert::GeneratorQueryHandler | |
| ~GeneratorQueryHandler () override | |
| Destructs the handler. | |
| std::unique_ptr< QueryExecution > | execution (QueryContext &context) override |
| Returns a threaded synchronous generator query execution for context. | |
Protected Member Functions inherited from albert::QueryHandler | |
| ~QueryHandler () override | |
| Destructs the handler. | |
| virtual void | setFuzzyMatching (bool enabled) |
| Sets the fuzzy matching mode to enabled. | |
| virtual void | setTrigger (const QString &trigger) |
| Notifies that the user-defined trigger has changed to trigger. | |
Protected Member Functions inherited from albert::Extension | |
| virtual | ~Extension () |
| Destructs the extension. | |
|
overrideprotected |
Destructs the handler.
|
overridevirtual |
Yields result of rankItems for context usage scored and lazily sorted.
Implements albert::GeneratorQueryHandler.
|
static |
Yields rank_items lazily sorted.
|
pure virtual |
Returns a list of scored matches for context.
The match score should make sense and often is the fraction of matched characters (legth of query string / length of matched string). The empty pattern matches everything and returns all items with a score of 0.
Implemented in albert::IndexQueryHandler.