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.

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.

◆ 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.

◆ 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.

◆ 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.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 04:08:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.