- 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>`

- List of all members, including inherited members

## Properties

- database : Database *
- expression : QStringList
- name : QString

## 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)

## Signals

void | databaseChanged(Database * database)
void | expressionChanged(QVariant expression)
void | nameChanged(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.

This is the declarative API equivalent of Database::putIndex() and Database::getIndexExpressions().

## Property Documentation

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

Access functions:

Database * | getDatabase()
void | setDatabase(Database * database)

Notifier signal:

void | databaseChanged(Database * database)

### expression : QStringList

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.

Access functions:

QStringList | getExpression()
void | setExpression(QStringList expression)

Notifier signal:

void | expressionChanged(QVariant expression)

### name : QString

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

Access functions:

QString | getName()
void | setName(const QString & name)

Notifier signal:

void | nameChanged(const QString & name)

## Member Function Documentation

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

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