- Index

# Index Class

The Index class defines an index to be stored in the database and queried using Query. Changes in documents affected by the index also update the index in the database. More...

Header: | #include <Index>
Instantiated By: | Index
Inherits: |

- List of all members, including inherited members

## Public Functions

| Index(QObject * parent = 0)
Database * | getDatabase()
QStringList | getExpression()
QString | getName()
void | setDatabase(Database * database)
void | setExpression(QStringList expression)
void | setName(const QString & name)

## Detailed Description

The Index class defines an index to be stored in the database and queried using Query. Changes in documents affected by the index also update the index in the database.

## Member Function Documentation

### Index::Index(QObject * parent = 0)

Instantiate a new Index with an optional parent, usually by declaring it as a QML item.

### Database * Index::getDatabase()

Returns the Database to lookup documents from and store the index in.

### QStringList Index::getExpression()

Returns the expression of the index. Both name and expression must be specified.

### QString Index::getName()

Returns the name of the index. Both name and expression must be specified.

### void Index::setDatabase(Database * database)

Sets the database to lookup documents from and store the index in. The dataInvalidated() signal will be emitted on all changes that could affect the index.

### void Index::setExpression(QStringList expression)

Sets the expression used. Both an expression and a name must be specified for an index to be created.

Also starts the process of creating the Index result list, which can then be queried or populate the Query model as is.

### void Index::setName(const QString & name)

Sets the name used. Both an expression and a name must be specified for an index to be created.