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

#include <albert/globalqueryhandler.h>

Description

Query handler participating in the global search.

By design, every global query handler is also a triggered query handler. Therefore this class inherits RankedQueryHandler and as such inherits its contract. I.e. the handler returns a complete set of match-scored items eagerly. The provided match scores will be combined with the usage-based scoring weighted by user configuration. Finally the items (of all global handlers) will be yielded lazily in order of their final score.

Note: Global queries are expected to complete within a few milliseconds.

Inheritance diagram for albert::GlobalQueryHandler:
[legend]

Public Member Functions

virtual std::vector< std::shared_ptr< Item > > handleEmptyQuery ()
 Returns a list of special items that should show up on an emtpy query.
 
- Public Member Functions inherited from albert::RankedQueryHandler
virtual std::vector< RankItemrankItems (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.
 

Protected Member Functions

 ~GlobalQueryHandler () override
 Destructs the handler.
 
- Protected Member Functions inherited from albert::RankedQueryHandler
 ~RankedQueryHandler () override
 Destructs the handler.
 
- Protected Member Functions inherited from albert::GeneratorQueryHandler
 ~GeneratorQueryHandler () override
 Destructs the handler.
 
std::unique_ptr< QueryExecutionexecution (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.
 

Additional Inherited Members

- Static Public Member Functions inherited from albert::RankedQueryHandler
static ItemGenerator lazySort (std::vector< RankItem > rank_items)
 Yields rank_items lazily sorted.
 

Constructor & Destructor Documentation

◆ ~GlobalQueryHandler()

albert::GlobalQueryHandler::~GlobalQueryHandler ( )
overrideprotected

Destructs the handler.

Member Function Documentation

◆ handleEmptyQuery()

virtual std::vector< std::shared_ptr< Item > > albert::GlobalQueryHandler::handleEmptyQuery ( )
virtual

Returns a list of special items that should show up on an emtpy query.

The empty pattern matches everything. For triggered queries this is desired and by design lots of triggered handlers reuse GlobalQueryHandler::rankItems. The empty global query is not executed. This function allows dedicated empty global query handling.


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