Albert
Loading...
Searching...
No Matches
albert::GlobalQueryHandler Class Referenceabstract

#include <globalqueryhandler.h>

Inheritance diagram for albert::GlobalQueryHandler:
albert::TriggerQueryHandler albert::Extension albert::IndexQueryHandler

Detailed Description

Global search query handler class.

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. Implements TriggeredQueryHandler.

Note
Do not use this for long running tasks!
See also
TriggeredQueryHandler

Classes

class  GlobalQuery
 The query interface used by GlobalQueryHandler. More...
 

Public Member Functions

 GlobalQueryHandler ()
 
 ~GlobalQueryHandler () override
 
virtual std::vector< RankItemhandleGlobalQuery (const GlobalQuery *) const =0
 The query processing function. More...
 
void applyUsageScore (std::vector< RankItem > *) const
 Takes rank items and modifies the score according to the users usage. More...
 
void handleTriggerQuery (TriggerQuery *) const override
 Implements handleTriggerQuery(…). More...
 
- Public Member Functions inherited from albert::TriggerQueryHandler
 TriggerQueryHandler ()
 
 ~TriggerQueryHandler ()
 
QString trigger () const
 The user configured trigger of this handler. More...
 
virtual QString synopsis () const
 The synopsis, displayed on empty query. More...
 
virtual QString defaultTrigger () const
 The default (not user defined) trigger. Default Extension::id(). More...
 
virtual bool allowTriggerRemap () const
 Enable user remapping of the trigger. Default false. More...
 
virtual bool supportsFuzzyMatching () const
 Fuzzy matching capability. Default false. More...
 
virtual bool fuzzyMatching () const
 Fuzzy matching. Default false. More...
 
virtual void setFuzzyMatching (bool enabled)
 Fuzzy matching behavior. Default does nothing. More...
 
virtual void handleTriggerQuery (TriggerQuery *) const =0
 The trigger query processing function. More...
 
- Public Member Functions inherited from albert::Extension
 Extension ()=default
 
virtual QString id () const =0
 The identifier of this extension. More...
 
virtual QString name () const =0
 Pretty, human readable name. More...
 
virtual QString description () const =0
 Brief description of this extension. More...
 

Additional Inherited Members

- Protected Member Functions inherited from albert::Extension
virtual ~Extension ()=default
 

Constructor & Destructor Documentation

◆ GlobalQueryHandler()

albert::GlobalQueryHandler::GlobalQueryHandler ( )

◆ ~GlobalQueryHandler()

albert::GlobalQueryHandler::~GlobalQueryHandler ( )
override

Member Function Documentation

◆ applyUsageScore()

void albert::GlobalQueryHandler::applyUsageScore ( std::vector< RankItem > *  ) const

Takes rank items and modifies the score according to the users usage.

Use this if you want to reuse your global results in the trigger handler.

◆ handleGlobalQuery()

virtual std::vector< RankItem > albert::GlobalQueryHandler::handleGlobalQuery ( const GlobalQuery ) const
pure virtual

The query processing function.

The match score should make sense and often (if not always) be the fraction matched chars (legth of query string / length of item title).

Returns
A list of match items. Empty query should return all items with a score of 0.
Note
Executed in a worker thread.

Implemented in albert::IndexQueryHandler.

◆ handleTriggerQuery()

void albert::GlobalQueryHandler::handleTriggerQuery ( TriggerQuery ) const
overridevirtual

Implements handleTriggerQuery(…).

Sort and batch add rankItems(…).

Note
Reimplement if the handler should have custom triggered behavior, but think twice if this is necessary. It may break user expectation.
See also
handleTriggerQuery and rankItems

Implements albert::TriggerQueryHandler.


The documentation for this class was generated from the following file: