Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.appengine.api.search
Interface IndexManager

    public interface IndexManager

A manager capable of listing available indexes, which can be queried about their metadata or have index/delete/search operations performed on them. For example:

     IndexManager indexManager = IndexManagerFactory.newIndexManager();
     List<Index> indexes = indexManager.listIndexes();
     for (Index index : indexes) {
       index.getName();
       index.getNamespace();
       index.getConsistency();
       index.search("query");
     }

IndexManager is also responsible for creating new indexes. For example:

     IndexManager indexManager = IndexManagerFactory.newIndexManager();
     Index index = indexManager.getIndex(IndexSpec.newBuilder().setName("myindex"));

Method Summary
`Index` | `getIndex(IndexSpec.Builder builder)` Returns an instance of `Index` corresponding to the specification built from the given `builder`.
`Index` | `getIndex(IndexSpec spec)` Returns an instance of `Index` corresponding to the provided specification.
`java.lang.String` | `getNamespace()` Returns the namespace associated with this index manager.
`ListIndexesResponse` | `listIndexes(ListIndexesRequest request)` Lists the indexes available.
`java.util.concurrent.Future<ListIndexesResponse>` | `listIndexesAsync(ListIndexesRequest request)` Lists the indexes available asynchronously.

Method Detail

### getIndex

    Index getIndex(IndexSpec spec)

  Returns an instance of `Index` corresponding to the provided specification.

  Returns:
    an instance of `Index` corresponding to the given `spec`

### getIndex

    Index getIndex(IndexSpec.Builder builder)

  Returns an instance of `Index` corresponding to the specification built from the given `builder`.

  Returns:
    an instance of `Index` corresponding to the given `spec`

### getNamespace

    java.lang.String getNamespace()

  Returns the namespace associated with this index manager. Each manager is assigned one namespace and all operations, such as listing documents, indexes inherit it. Also, when you fetch an index, the namespace of this index manager is passed to the returned index.

  Returns:
    the namespace associated with this index manager

### listIndexes

    ListIndexesResponse listIndexes(ListIndexesRequest request)

  Lists the indexes available. The following code fragment shows how to list the schemas of each available `Index`.

         // Get the index manager for the default namespace
         IndexManager indexManager = IndexManagerFactory.newIndexManager();

         // List the first page of indexes available and retrieve schemas
         ListIndexesResponse response = indexManager.listIndexes(
             ListIndexesRequest.newBuilder().setSchemaFetched(true).build());

         // List out elements of Schema
         for (Index index : response) {
           String name = index.getName();
           Schema schema = index.getSchema();
           for (String fieldName : schema.getFieldNames()) {
              List typesForField = schema.getFieldTypes(fieldName);
           }
         }

  Parameters:
    `request` - a request specifying which indexes to list
  Returns:
    a `ListIndexesResponse` containing list of existing indexes
  Throws:
    `ListIndexesException` - if there is a failure in the search service listing indexes

### listIndexesAsync

    java.util.concurrent.Future<ListIndexesResponse> listIndexesAsync(ListIndexesRequest request)

  Lists the indexes available asynchronously.

  Parameters:
    `request` - a request specifying which indexes to list
  Returns:
    a `Future` that will allow getting a `ListIndexesResponse` containing a list of existing indexes

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD