Baloo::Query

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 53 of file 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 Baloo decides should be ideal.

This criteria is based on the mtime of the file.

This is the default sorting mechanism.

Definition at line 104 of file query.h.

Constructor & Destructor Documentation

◆ Query() [1/2]

Query::Query ( )

Definition at line 42 of file query.cpp.

◆ Query() [2/2]

Query::Query ( const Query & rhs)

Definition at line 47 of file query.cpp.

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

◆ addTypes()

void Query::addTypes ( const QStringList & typeList)

Definition at line 59 of file query.cpp.

◆ dayFilter()

int Query::dayFilter ( ) const

Definition at line 131 of file query.cpp.

◆ exec()

ResultIterator Query::exec ( )

Definition at line 156 of file query.cpp.

◆ fromJSON()

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

Definition at line 245 of file query.cpp.

◆ fromSearchUrl()

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

Definition at line 321 of file query.cpp.

◆ includeFolder()

QString Query::includeFolder ( ) const

Definition at line 146 of file query.cpp.

◆ limit()

uint Query::limit ( ) const

Definition at line 94 of file query.cpp.

◆ monthFilter()

int Query::monthFilter ( ) const

Definition at line 126 of file query.cpp.

◆ offset()

uint Query::offset ( ) const

Definition at line 104 of file query.cpp.

◆ operator!=()

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

Definition at line 379 of file query.cpp.

◆ operator=()

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

Definition at line 384 of file query.cpp.

◆ operator==()

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

Definition at line 355 of file query.cpp.

◆ searchString()

QString Query::searchString ( ) const

Definition at line 82 of file query.cpp.

◆ setDateFilter()

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

Definition at line 114 of file query.cpp.

◆ setIncludeFolder()

void Query::setIncludeFolder ( const QString & folder)

Only files in this folder will be returned.

Definition at line 151 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 99 of file query.cpp.

◆ setOffset()

void Query::setOffset ( uint offset)

Definition at line 109 of file 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.

Definition at line 87 of file query.cpp.

◆ setSortingOption()

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

Definition at line 136 of file query.cpp.

◆ setType()

void Query::setType ( const QString & type)

Definition at line 66 of file query.cpp.

◆ setTypes()

void Query::setTypes ( const QStringList & types)

Definition at line 72 of file query.cpp.

◆ sortingOption()

Query::SortingOption Query::sortingOption ( ) const

Definition at line 141 of file query.cpp.

◆ titleFromQueryUrl()

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

Definition at line 349 of file query.cpp.

◆ toJSON()

QByteArray Query::toJSON ( )

Definition at line 196 of file query.cpp.

◆ toSearchUrl()

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

Definition at line 288 of file query.cpp.

◆ types()

QStringList Query::types ( ) const

Definition at line 77 of file query.cpp.

◆ yearFilter()

int Query::yearFilter ( ) const

Definition at line 121 of file 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 Sat Dec 21 2024 16:56:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.