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


The results are returned in the most efficient order.

They can be returned in any order.


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.


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 45 of file core/query.cpp.

◆ Query() [2/3]

Query::Query ( const Term & t)

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

◆ Query() [3/3]

Query::Query ( const Query & rhs)

Definition at line 56 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 174 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 73 of file core/query.cpp.

◆ addTypes()

void Query::addTypes ( const QStringList & typeList)

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

◆ customOption()

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

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

◆ customOptions()

QVariantMap Query::customOptions ( ) const

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

◆ dayFilter()

int Query::dayFilter ( ) const

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

◆ fromJSON()

Query Query::fromJSON ( const QByteArray & arr)

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

◆ fromSearchUrl()

Query Query::fromSearchUrl ( const QUrl & url)

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

◆ limit()

uint Query::limit ( ) const

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

◆ monthFilter()

int Query::monthFilter ( ) const

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

◆ offset()

uint Query::offset ( ) const

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

◆ operator=()

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

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

◆ operator==()

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

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

◆ removeCustomOption()

void Query::removeCustomOption ( const QString & option)

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

◆ searchString()

QString Query::searchString ( ) const

Definition at line 101 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 131 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 116 of file core/query.cpp.

◆ setOffset()

void Query::setOffset ( uint offset)

Definition at line 126 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 106 of file core/query.cpp.

◆ setSortingOption()

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

Definition at line 153 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 163 of file core/query.cpp.

◆ setTerm()

void Query::setTerm ( const Term & t)

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

◆ setType()

void Query::setType ( const QString & type)

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

◆ setTypes()

void Query::setTypes ( const QStringList & types)

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

◆ sortingOption()

Query::SortingOption Query::sortingOption ( ) const

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

◆ sortingProperty()

QString Query::sortingProperty ( ) const

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

◆ term()

Term Query::term ( ) const

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

◆ titleFromQueryUrl()

QString Query::titleFromQueryUrl ( const QUrl & url)

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

◆ toJSON()

QByteArray Query::toJSON ( ) const

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

◆ toSearchUrl()

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

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

◆ types()

QStringList Query::types ( ) const

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

◆ yearFilter()

int Query::yearFilter ( ) const

Definition at line 138 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 Tue Mar 26 2024 11:15:27 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.