• Modules
  • U1db
  • Query
  • Query Class

    The Query class generates a filtered list of documents based on a query using the given Index. More...

    #include <Query>

    Properties

    Public Functions

    Query(QObject * parent = 0)
    QStringList getDocuments()
    Index * getIndex()
    QVariant getQuery()
    QList<QVariant> getResults()
    void resetModel()
    void setIndex(Index * index)
    void setQuery(QVariant query)

    Signals

    void documentsChanged(QStringList documents)
    void indexChanged(Index * index)
    void queryChanged(QVariant query)
    void resultsChanged(QList<QVariant> results)

    Detailed Description

    The Query class generates a filtered list of documents based on a query using the given Index.

    Query can be used as a QAbstractListModel, delegates will then have access to docId and contents analogous to the properties of Document.

    Property Documentation

    documents : const QStringList

    The docId's of all matched documents.

    Access functions:

    QStringList getDocuments()

    Notifier signal:

    void documentsChanged(QStringList documents)

    index : Index *

    Sets the Index to use. The index must have a valid name and index expressions. If no query is set, the default is all results of the index.

    Access functions:

    Index * getIndex()
    void setIndex(Index * index)

    Notifier signal:

    void indexChanged(Index * index)

    query : QVariant

    A query in one of the allowed forms: 'value', ['value'] or [{'sub-field': 'value'}]. The default is equivalent to '*'.

    Access functions:

    QVariant getQuery()
    void setQuery(QVariant query)

    Notifier signal:

    void queryChanged(QVariant query)

    results : const QList<QVariant>

    The results of the query as a list.

    Access functions:

    QList<QVariant> getResults()

    Notifier signal:

    void resultsChanged(QList<QVariant> results)

    Member Function Documentation

    Query::Query(QObject * parent = 0)

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

    See also setQuery().

    void Query::resetModel()

    Query::resetModel

    Resets the model of the Query