|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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.
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
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 |
|---|
Index getIndex(IndexSpec spec)
Index corresponding to the provided
specification.
Index corresponding to the given
specIndex getIndex(IndexSpec.Builder builder)
Index corresponding to the
specification built from the given builder.
Index corresponding to the given
specjava.lang.String getNamespace()
ListIndexesResponse listIndexes(ListIndexesRequest request)
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);
}
}
request - a request specifying which indexes to list
ListIndexesResponse containing list of existing indexes
ListIndexesException - if there is a failure in the search service
listing indexesjava.util.concurrent.Future<ListIndexesResponse> listIndexesAsync(ListIndexesRequest request)
request - a request specifying which indexes to list
Future that will allow getting a
ListIndexesResponse containing a list of existing indexes
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||