#include <Soprano/Index/IndexFilterModel>
Public Member Functions | |
IndexFilterModel (const QString &indexDir, Soprano::Model *model=0) | |
IndexFilterModel (CLuceneIndex *index, Soprano::Model *model=0) | |
~IndexFilterModel () | |
CLuceneIndex * | index () const |
Soprano::Error::ErrorCode | addStatement (const Soprano::Statement &statement) |
Soprano::Error::ErrorCode | removeStatement (const Soprano::Statement &statement) |
Soprano::Error::ErrorCode | removeAllStatements (const Soprano::Statement &statement) |
QueryResultIterator | executeQuery (const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const |
void | setTransactionCacheSize (int size) |
int | transactionCacheSize () const |
void | rebuildIndex () |
void | addIndexOnlyPredicate (const QUrl &predicate) |
void | setIndexOnlyPredicates (const QList< QUrl > &predicates) |
QList< QUrl > | indexOnlyPredicates () const |
All statements with a literal object will be indexed. The literals can then be searched with CLucene queries. More details regarding queries can be found in the documentation fo executeQuery().
Definition at line 60 of file indexfiltermodel.h.
Soprano::Index::IndexFilterModel::IndexFilterModel | ( | const QString & | indexDir, | |
Soprano::Model * | model = 0 | |||
) |
Create a new index model.
indexDir | The directory where the index should be stored. If the directory already contains an index, it will be used. Otherwise a new one will be created. | |
model | The parent model to forward the calls to. If 0 the Model has to be set later on with FilterModel::setParentModel. |
Soprano::Index::IndexFilterModel::IndexFilterModel | ( | CLuceneIndex * | index, | |
Soprano::Model * | model = 0 | |||
) |
Create a new index model.
index | The index to be used. The filter model will NOT take ownership of the index. The caller has to take care of deleting the index. | |
model | The parent model to forward the calls to. If 0 the Model has to be set later on with FilterModel::setParentModel. |
Soprano::Index::IndexFilterModel::~IndexFilterModel | ( | ) |
Destructor.
CLuceneIndex* Soprano::Index::IndexFilterModel::index | ( | ) | const |
Retrieve the index used by this index model.
Soprano::Error::ErrorCode Soprano::Index::IndexFilterModel::addStatement | ( | const Soprano::Statement & | statement | ) | [virtual] |
Adds a new statement.
This will index the statement and then forward the call to the parent model.
Reimplemented from Soprano::FilterModel.
Soprano::Error::ErrorCode Soprano::Index::IndexFilterModel::removeStatement | ( | const Soprano::Statement & | statement | ) | [virtual] |
Removes a statement.
This will remove the statement from the index and then forward the call to the parent model.
Reimplemented from Soprano::FilterModel.
Soprano::Error::ErrorCode Soprano::Index::IndexFilterModel::removeAllStatements | ( | const Soprano::Statement & | statement | ) | [virtual] |
Removes statements.
This will remove the statements from the index and then forward the call to the parent model.
Reimplemented from Soprano::FilterModel.
QueryResultIterator Soprano::Index::IndexFilterModel::executeQuery | ( | const QString & | query, | |
Query::QueryLanguage | language, | |||
const QString & | userQueryLanguage = QString() | |||
) | const [virtual] |
The IndexFilterModel is currently based on CLucene. While the index itself is available via index() and allows querying via CLucene queries it is not available over the Soprano::Client interface. Thus, CLucene queries are supported through this method and will return QueryHit objects wrapped in a QueryResultIterator.
Future versions of Soprano will support querying the index through the Soprano::Query API (still unfinished and unstable).
query | The query string. This can be a CLucene query in which case the query will be passed to CLuceneIndex. | |
language | The query language. Set to Soprano::Query::QueryLanguageUser for CLucene queries. | |
userQueryLanguage | If language equals Query::QueryLanguageUser userQueryLanguage defines the language to use. Use "lucene" to perform CLucene queries. |
Reimplemented from Soprano::FilterModel.
void Soprano::Index::IndexFilterModel::setTransactionCacheSize | ( | int | size | ) |
Set the number or addStatement operations that are to be cached in the index. The default value is 1 which means that no caching occurs. Be aware that query operations will always close cached transactions.
size | The number of operations that should be handled in one transaction. Set to 1 to disable. |
int Soprano::Index::IndexFilterModel::transactionCacheSize | ( | ) | const |
void Soprano::Index::IndexFilterModel::rebuildIndex | ( | ) |
Rebuild the complete index. This means that the index will be cleared and all literal statements will be re-indexed.
This method is purely intended for maintenance.
void Soprano::Index::IndexFilterModel::addIndexOnlyPredicate | ( | const QUrl & | predicate | ) |
Add a predicate which should only be indexed. This might be useful for very large literals whose value is of no interest but which should be searchable.
predicate | The predicate that should only be indexed but not stored in the underlying Model. |
Set the predicates that should only be indexed. This might be useful for very large literals whose value is of no interest but which should be searchable.
predicates | A list of predicates that should only be indexed but not stored in the underlying Model. |
The IndexFilterModel supports to not forward certain predicates to the parent Model but only index their value. This might be useful for very large literals whose value is of no interest but which should be searchable.