Search for usage in LXR

#include <Baloo/Query>

Public Types

enum  SortingOption { SortNone, SortAuto }

Public Member Functions

 Query (const Query &rhs)
void addType (const QString &type)
void addTypes (const QStringList &typeList)
int dayFilter () const
ResultIterator exec ()
QString includeFolder () const
uint limit () const
int monthFilter () const
uint offset () const
bool operator!= (const Query &rhs) const
Queryoperator= (const Query &rhs)
bool operator== (const Query &rhs) const
QString searchString () const
void setDateFilter (int year, int month=0, int day=0)
void setIncludeFolder (const QString &folder)
void setLimit (uint limit)
void setOffset (uint offset)
void setSearchString (const QString &str)
void setSortingOption (SortingOption option)
void setType (const QString &type)
void setTypes (const QStringList &types)
SortingOption sortingOption () const
QByteArray toJSON ()
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

The Query class is the central class to query to search for files from the Index.

This class has an inbuilt parser which recognizes words along with AND / OR and parenthesis and specific properties. This can be used with the setSearchString method

Definition at line 51 of file query.h.

Member Enumeration Documentation

◆ SortingOption

enum Baloo::Query::SortingOption

The results are returned in the most efficient order.

They can be returned in any order.


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

This criteria is based on the mtime of the file.

This is the default sorting mechanism.

Definition at line 102 of file query.h.

Member Function Documentation

◆ addType()

void Query::addType ( const QString type)

Add a type to the results of the query.

Every file has a higher level type such as "Audio", "Video", "Image", "Document", etc.

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 57 of file query.cpp.

◆ setDateFilter()

void Baloo::Query::setDateFilter ( int  year,
int  month = 0,
int  day = 0 

Filter the results in the specified date range.

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

◆ setIncludeFolder()

void Query::setIncludeFolder ( const QString folder)

Only files in this folder will be returned.

Definition at line 154 of file query.cpp.

◆ setLimit()

void Query::setLimit ( uint  limit)

Only a maximum of limit results will be returned.

By default the value is -1

Definition at line 102 of file query.cpp.

◆ setSearchString()

void Baloo::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.

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 Sat Dec 2 2023 03:56:36 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.