com.thinkaurelius.titan.diskstorage.indexing

## Interface IndexProvider

- All Superinterfaces:
    IndexInformation

      public interface IndexProvider
      extends IndexInformation

  External index for querying. An index can contain an arbitrary number of index stores which are updated and queried separately.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `BaseTransactionConfigurable` | `beginTransaction(BaseTransactionConfig config)` Returns a transaction handle for a new index transaction.
    `void` | `clearStorage()` Clears the index and removes all entries in all stores.
    `void` | `close()` Closes the index
    `void` | `mutate(Map<String,Map<String,IndexMutation>> mutations, KeyInformation.IndexRetriever informations, BaseTransaction tx)` Mutates the index (adds and removes fields or entire documents)
    `List<String>` | `query(IndexQuery query, KeyInformation.IndexRetriever informations, BaseTransaction tx)` Executes the given query against the index.
    `Iterable<RawQuery.Result<String>>` | `query(RawQuery query, KeyInformation.IndexRetriever informations, BaseTransaction tx)` Executes the given raw query against the index
    `void` | `register(String store, String key, KeyInformation information, BaseTransaction tx)` This method registers a new key for the specified index store with the given data type.
    `void` | `restore(Map<String,Map<String,List<IndexEntry>>> documents, KeyInformation.IndexRetriever informations, BaseTransaction tx)` Restores the index to the state of the primary data store as given in the `documents` variable.

    - ### Methods inherited from interface com.thinkaurelius.titan.diskstorage.indexing.IndexInformation

      `getFeatures, supports, supports`

- - ### Method Detail

    - #### register

          void register(String store,
                      String key,
                      KeyInformation information,
                      BaseTransaction tx)
                        throws BackendException

      This method registers a new key for the specified index store with the given data type. This allows the IndexProvider to prepare the index if necessary. It is expected that this method is first called with each new key to inform the index of the expected type before the key is used in any documents.
      Parameters:
        `store` - Index store
        `key` - New key to register
        `information` - Information on the key to register
        `tx` - enclosing transaction
      Throws:
        `BackendException`

    - #### mutate

          void mutate(Map<String,Map<String,IndexMutation>> mutations,
                    KeyInformation.IndexRetriever informations,
                    BaseTransaction tx)
                      throws BackendException

      Mutates the index (adds and removes fields or entire documents)
      Parameters:
        `mutations` - Updates to the index. First map contains all the mutations for each store. The inner map contains all changes for each document in an `IndexMutation`.
        `informations` - Information on the keys used in the mutation accessible through `KeyInformation.IndexRetriever`.
        `tx` - Enclosing transaction
      Throws:
        `BackendException`
      See Also:
        `IndexMutation`

    - #### restore

          void restore(Map<String,Map<String,List<IndexEntry>>> documents,
                     KeyInformation.IndexRetriever informations,
                     BaseTransaction tx)
                       throws BackendException

      Restores the index to the state of the primary data store as given in the `documents` variable. When this method returns, the index records for the given documents exactly matches the provided data. Unlike `mutate(java.util.Map, KeyInformation.IndexRetriever, BaseTransaction)` this method does not do a delta-update, but entirely replaces the documents with the provided data or deletes them if the document content is empty.
      Parameters:
        `documents` - The outer map maps stores to documents, the inner contains the documents mapping document ids to the document content which is a list of `IndexEntry`. If that list is empty, that means this document should not exist and ought to be deleted.
        `informations` - Information on the keys used in the mutation accessible through `KeyInformation.IndexRetriever`.
        `tx` - Enclosing transaction
      Throws:
        `BackendException`

    - #### query

          List<String> query(IndexQuery query,
                           KeyInformation.IndexRetriever informations,
                           BaseTransaction tx)
                             throws BackendException

      Executes the given query against the index.
      Parameters:
        `query` - Query to execute
        `informations` - Information on the keys used in the query accessible through `KeyInformation.IndexRetriever`.
        `tx` - Enclosing transaction
      Returns:
        The ids of all matching documents
      Throws:
        `BackendException`
      See Also:
        `IndexQuery`

    - #### query

          Iterable<RawQuery.Result<String>> query(RawQuery query,
                                                KeyInformation.IndexRetriever informations,
                                                BaseTransaction tx)
                                                  throws BackendException

      Executes the given raw query against the index
      Parameters:
        `query` - Query to execute
        `informations` - Information on the keys used in the query accessible through `KeyInformation.IndexRetriever`.
        `tx` - Enclosing transaction
      Returns:
        Results objects for all matching documents (i.e. document id and score)
      Throws:
        `BackendException`
      See Also:
        `RawQuery`

    - #### beginTransaction

          BaseTransactionConfigurable beginTransaction(BaseTransactionConfig config)
                                                       throws BackendException

      Returns a transaction handle for a new index transaction.
      Returns:
        New Transaction Handle
      Throws:
        `BackendException`

    - #### close

          void close()
                     throws BackendException

      Closes the index
      Throws:
        `BackendException`

    - #### clearStorage

          void clearStorage()
                            throws BackendException

      Clears the index and removes all entries in all stores.
      Throws:
        `BackendException`

Copyright © 2012–2014. All rights reserved.