Akonadi::Search::Query

Search for usage in LXR

#include <query.h>

Public Types

enum  SortingOption { SortNone , SortAuto , SortProperty }
 

Public Member Functions

 Query (const Query &rhs)
 
 Query (const Term &t)
 
void addCustomOption (const QString &option, const QVariant &value)
 
void addType (const QString &type)
 
void addTypes (const QStringList &typeList)
 
QVariant customOption (const QString &option) const
 
QVariantMap customOptions () const
 
int dayFilter () const
 
ResultIterator exec ()
 
uint limit () const
 
int monthFilter () const
 
uint offset () const
 
Queryoperator= (const Query &rhs)
 
bool operator== (const Query &rhs) const
 
void removeCustomOption (const QString &option)
 
QString searchString () const
 
void setDateFilter (int year, int month=-1, int day=-1)
 
void setLimit (uint limit)
 
void setOffset (uint offset)
 
void setSearchString (const QString &str)
 
void setSortingOption (SortingOption option)
 
void setSortingProperty (const QString &property)
 
void setTerm (const Term &t)
 
void setType (const QString &type)
 
void setTypes (const QStringList &types)
 
SortingOption sortingOption () const
 
QString sortingProperty () const
 
Term term () const
 
QByteArray toJSON () const
 
QUrl toSearchUrl (const QString &title=QString())
 
QStringList types () const
 
int yearFilter () const
 

Static Public Member Functions

static Query fromJSON (const QByteArray &arr)
 
static Query fromSearchUrl (const QUrl &url)
 
static QString titleFromQueryUrl (const QUrl &url)
 

Detailed Description

Search query.

Definition at line 26 of file core/query.h.

Member Enumeration Documentation

◆ SortingOption

Enumerator
SortNone 

The results are returned in the most efficient order.

They can be returned in any order.

SortAuto 

The results are returned in the order the SearchStore decides should be ideal.

This criteria could be based on any factors. Read the documentation for the corresponding search store.

SortProperty 

The results are returned based on the explicit property specified.

The implementation of this depends on the search store.

Definition at line 88 of file core/query.h.

Constructor & Destructor Documentation

◆ Query() [1/3]

Query::Query ( )

Definition at line 47 of file core/query.cpp.

◆ Query() [2/3]

Query::Query ( const Term & t)

Definition at line 52 of file core/query.cpp.

◆ Query() [3/3]

Query::Query ( const Query & rhs)

Definition at line 58 of file core/query.cpp.

Member Function Documentation

◆ addCustomOption()

void Query::addCustomOption ( const QString & option,
const QVariant & value )

Adds a custom option which any search backend could use to configure the query result.

Each backend has their own custom options which should be looked up in their corresponding documentation

Definition at line 176 of file core/query.cpp.

◆ addType()

void Query::addType ( const QString & type)

Add a type to the results of the query.

Each Item in the result must contain one of the types. This is generally used to filter only Files, Emails, Tags, etc

One can add multiple types in one go by separating individual types with a '/'. Eg - "File/Audio".

Please note that the types are ANDed together. So searching for "Image" and "Video" will probably never return any results. Have a look at KFileMetaData::TypeInfo for a list of type names.

Definition at line 75 of file core/query.cpp.

◆ addTypes()

void Query::addTypes ( const QStringList & typeList)

Definition at line 80 of file core/query.cpp.

◆ customOption()

QVariant Query::customOption ( const QString & option) const
nodiscard

Definition at line 181 of file core/query.cpp.

◆ customOptions()

QVariantMap Query::customOptions ( ) const
nodiscard

Definition at line 186 of file core/query.cpp.

◆ dayFilter()

int Query::dayFilter ( ) const
nodiscard

Definition at line 150 of file core/query.cpp.

◆ fromJSON()

Query Query::fromJSON ( const QByteArray & arr)
static

Definition at line 283 of file core/query.cpp.

◆ fromSearchUrl()

Query Query::fromSearchUrl ( const QUrl & url)
static

Definition at line 354 of file core/query.cpp.

◆ limit()

uint Query::limit ( ) const
nodiscard

Definition at line 113 of file core/query.cpp.

◆ monthFilter()

int Query::monthFilter ( ) const
nodiscard

Definition at line 145 of file core/query.cpp.

◆ offset()

uint Query::offset ( ) const
nodiscard

Definition at line 123 of file core/query.cpp.

◆ operator=()

Query & Query::operator= ( const Query & rhs)

Definition at line 392 of file core/query.cpp.

◆ operator==()

bool Query::operator== ( const Query & rhs) const

Definition at line 371 of file core/query.cpp.

◆ removeCustomOption()

void Query::removeCustomOption ( const QString & option)

Definition at line 191 of file core/query.cpp.

◆ searchString()

QString Query::searchString ( ) const
nodiscard

Definition at line 103 of file core/query.cpp.

◆ setDateFilter()

void Query::setDateFilter ( int year,
int month = -1,
int day = -1 )

Filter the results in the specified date range.

The year/month/day may be set to -1 in order to ignore it.

Definition at line 133 of file core/query.cpp.

◆ setLimit()

void Query::setLimit ( uint limit)

Only a maximum of limit results will be returned.

By default the limit is 100000.

Definition at line 118 of file core/query.cpp.

◆ setOffset()

void Query::setOffset ( uint offset)

Definition at line 128 of file core/query.cpp.

◆ setSearchString()

void Query::setSearchString ( const QString & str)

Set some text which should be used to search for Items.

This contain a single word or an entire sentence.

Each search backend will interpret it in its own way, and try to give the best possible results.

Definition at line 108 of file core/query.cpp.

◆ setSortingOption()

void Query::setSortingOption ( Query::SortingOption option)

Definition at line 155 of file core/query.cpp.

◆ setSortingProperty()

void Query::setSortingProperty ( const QString & property)

Sets the property that should be used for sorting.

This automatically set the sorting mechanism to SortProperty

Definition at line 165 of file core/query.cpp.

◆ setTerm()

void Query::setTerm ( const Term & t)

Definition at line 65 of file core/query.cpp.

◆ setType()

void Query::setType ( const QString & type)

Definition at line 87 of file core/query.cpp.

◆ setTypes()

void Query::setTypes ( const QStringList & types)

Definition at line 93 of file core/query.cpp.

◆ sortingOption()

Query::SortingOption Query::sortingOption ( ) const
nodiscard

Definition at line 160 of file core/query.cpp.

◆ sortingProperty()

QString Query::sortingProperty ( ) const
nodiscard

Definition at line 171 of file core/query.cpp.

◆ term()

Term Query::term ( ) const
nodiscard

Definition at line 70 of file core/query.cpp.

◆ titleFromQueryUrl()

QString Query::titleFromQueryUrl ( const QUrl & url)
static

Definition at line 365 of file core/query.cpp.

◆ toJSON()

QByteArray Query::toJSON ( ) const
nodiscard

Definition at line 231 of file core/query.cpp.

◆ toSearchUrl()

QUrl Query::toSearchUrl ( const QString & title = QString())
nodiscard

Definition at line 338 of file core/query.cpp.

◆ types()

QStringList Query::types ( ) const
nodiscard

Definition at line 98 of file core/query.cpp.

◆ yearFilter()

int Query::yearFilter ( ) const
nodiscard

Definition at line 140 of file core/query.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.