Akonadi::PersistentSearchAttribute

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
 
QList< qint64 > queryCollections () const
 
QString queryString () const
 
void setQueryCollections (const QList< Collection > &collections)
 
void setQueryCollections (const QList< 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.

Example:

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";
return;
}
const Collection searchCollection = job->createdCollection();
...
// now let's change the query
if ( searchCollection.hasAttribute<Akonadi::PersistentSearchAttribute>() ) {
attribute->setQueryString( "... another query string ..." );
Akonadi::CollectionModifyJob *modifyJob = new Akonadi::CollectionModifyJob( searchCollection );
connect( modifyJob, SIGNAL(result(KJob*)), SLOT(modifyFinished(KJob*)) );
}
...
}
Job that modifies a collection in the Akonadi storage.
Represents a collection of PIM items.
Definition collection.h:62
bool hasAttribute(const QByteArray &name) const
Returns true if the collection has an attribute of the given type name, false otherwise.
Attribute * attribute(const QByteArray &name)
Returns the attribute of the given type name if available, 0 otherwise.
An attribute to store query properties of persistent search collections.
void setQueryString(const QString &query)
Sets the query string to be used for this search.
Job that creates a virtual/search collection in the Akonadi storage.
int error() const
Author
Volker Krause vkrau.nosp@m.se@k.nosp@m.de.or.nosp@m.g
Since
4.5

Definition at line 63 of file persistentsearchattribute.h.

Constructor & Destructor Documentation

◆ PersistentSearchAttribute()

PersistentSearchAttribute::PersistentSearchAttribute ( )
explicit

Creates a new persistent search attribute.

Definition at line 26 of file persistentsearchattribute.cpp.

◆ ~PersistentSearchAttribute()

PersistentSearchAttribute::~PersistentSearchAttribute ( )
overridedefault

Destroys the persistent search attribute.

Member Function Documentation

◆ isRecursive()

bool PersistentSearchAttribute::isRecursive ( ) const
nodiscard

Returns whether the search is recursive.

Since
4.13

Definition at line 62 of file persistentsearchattribute.cpp.

◆ isRemoteSearchEnabled()

bool PersistentSearchAttribute::isRemoteSearchEnabled ( ) const
nodiscard

Returns whether remote search is enabled.

Since
4.13

Definition at line 72 of file persistentsearchattribute.cpp.

◆ queryCollections()

QList< qint64 > PersistentSearchAttribute::queryCollections ( ) const
nodiscard

Returns IDs of collections that will be queried.

Since
4.13

Definition at line 43 of file persistentsearchattribute.cpp.

◆ queryString()

QString PersistentSearchAttribute::queryString ( ) const
nodiscard

Returns the query string used for this search.

Definition at line 33 of file persistentsearchattribute.cpp.

◆ setQueryCollections() [1/2]

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

Sets collections to be queried.

Parameters
collectionsList of collections to be queries
Since
4.13

Definition at line 48 of file persistentsearchattribute.cpp.

◆ setQueryCollections() [2/2]

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

Sets IDs of collections to be queries.

Parameters
collectionsIdsIDs of collections to query
Since
4.13

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.

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

Parameters
recursiveWhether to search recursively
Since
4.13

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.

Parameters
enabledWhether remote search is enabled
Since
4.13

Definition at line 77 of file persistentsearchattribute.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 Fri Oct 4 2024 11:57:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.