Search for usage in LXR

Akonadi::PersistentSearchAttribute Class Reference

#include <persistentsearchattribute.h>

Inheritance diagram for Akonadi::PersistentSearchAttribute:

Public Member Functions

 PersistentSearchAttribute ()
 ~PersistentSearchAttribute () override
bool isRecursive () const
bool isRemoteSearchEnabled () const
QVector< qint64 > queryCollections () const
QString queryString () const
void setQueryCollections (const QVector< Collection > &collections)
void setQueryCollections (const QVector< qint64 > &collectionsIds)
void setQueryString (const QString &query)
void setRecursive (bool recursive)
void setRemoteSearchEnabled (bool enabled)
- Public Member Functions inherited from Akonadi::Attribute
virtual ~Attribute ()
virtual Attributeclone () const =0
virtual void deserialize (const QByteArray &data)=0
virtual QByteArray serialized () const =0
virtual QByteArray type () const =0

Additional Inherited Members

- Public Types inherited from Akonadi::Attribute
using List = QList< Attribute * >
- Protected Member Functions inherited from Akonadi::Attribute
 Attribute (const Attribute &)=default

Detailed Description

An attribute to store query properties of persistent search collections.

This attribute is attached to persistent search collections automatically when creating a new persistent search with SearchCreateJob. Later on the search query can be changed by modifying this attribute of the persistent search collection with an CollectionModifyJob.


const QString name = "My search folder";
const QString query = "...";
connect( job, SIGNAL(result(KJob*)), SLOT(jobFinished(KJob*)) );
MyClass::jobFinished( KJob *job )
if ( job->error() ) {
qDebug() << "Error occurred";
const Collection searchCollection = job->createdCollection();
// now let's change the query
if ( searchCollection.hasAttribute<Akonadi::PersistentSearchAttribute>() ) {
Akonadi::PersistentSearchAttribute *attribute = searchCollection.attribute<Akonadi::PersistentSearchAttribute>();
attribute->setQueryString( "... another query string ..." );
Akonadi::CollectionModifyJob *modifyJob = new Akonadi::CollectionModifyJob( searchCollection );
connect( modifyJob, SIGNAL(result(KJob*)), SLOT(modifyFinished(KJob*)) );
Volker Krause vkrau[email protected][email protected][email protected]de.or[email protected]g

Definition at line 63 of file persistentsearchattribute.h.

Constructor & Destructor Documentation

◆ PersistentSearchAttribute()

PersistentSearchAttribute::PersistentSearchAttribute ( )

Creates a new persistent search attribute.

Definition at line 26 of file persistentsearchattribute.cpp.

◆ ~PersistentSearchAttribute()

PersistentSearchAttribute::~PersistentSearchAttribute ( )

Destroys the persistent search attribute.

Member Function Documentation

◆ isRecursive()

bool PersistentSearchAttribute::isRecursive ( ) const

Returns whether the search is recursive.


Definition at line 62 of file persistentsearchattribute.cpp.

◆ isRemoteSearchEnabled()

bool PersistentSearchAttribute::isRemoteSearchEnabled ( ) const

Returns whether remote search is enabled.


Definition at line 72 of file persistentsearchattribute.cpp.

◆ queryCollections()

QVector< qint64 > PersistentSearchAttribute::queryCollections ( ) const

Returns IDs of collections that will be queried.


Definition at line 43 of file persistentsearchattribute.cpp.

◆ queryString()

QString PersistentSearchAttribute::queryString ( ) const

Returns the query string used for this search.

Definition at line 33 of file persistentsearchattribute.cpp.

◆ setQueryCollections() [1/2]

void PersistentSearchAttribute::setQueryCollections ( const QVector< Collection > &  collections)

Sets collections to be queried.

collectionsList of collections to be queries

Definition at line 48 of file persistentsearchattribute.cpp.

◆ setQueryCollections() [2/2]

void PersistentSearchAttribute::setQueryCollections ( const QVector< qint64 > &  collectionsIds)

Sets IDs of collections to be queries.

collectionsIdsIDs of collections to query

Definition at line 57 of file persistentsearchattribute.cpp.

◆ setQueryString()

void PersistentSearchAttribute::setQueryString ( const QString query)

Sets the query string to be used for this search.

queryThe query string.

Definition at line 38 of file persistentsearchattribute.cpp.

◆ setRecursive()

void PersistentSearchAttribute::setRecursive ( bool  recursive)

Sets whether the search should recurse into collections.

When set to true, all child collections of the specific collections will be search recursively.

recursiveWhether to search recursively

Definition at line 67 of file persistentsearchattribute.cpp.

◆ setRemoteSearchEnabled()

void PersistentSearchAttribute::setRemoteSearchEnabled ( bool  enabled)

Sets whether resources should be queried too.

When set to true, Akonadi will search local indexed items and will also query resources that support server-side search, to forward the query to remote storage (for example using SEARCH feature on IMAP servers) and merge their results with results from local index.

This is useful especially when searching resources, that don't fetch full payload by default, for example the IMAP resource, which only fetches headers by default and the body is fetched on demand, which means that emails that were not yet fully fetched cannot be indexed in local index, and thus cannot be searched. With remote search, even those emails can be included in search results.

enabledWhether remote search is enabled

Definition at line 77 of file persistentsearchattribute.cpp.

The documentation for this class was generated from the following files:
Job that modifies a collection in the Akonadi storage.
Job that creates a virtual/search collection in the Akonadi storage.
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
void setQueryString(const QString &query)
Sets the query string to be used for this search.
An attribute to store query properties of persistent search collections.
const char * name(StandardAction id)
int error() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 16 2022 04:00:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.