|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SearchService
The SearchService is used to get available indexes, which can be queried about their metadata or have index/delete/search operations performed on them. For example:
SearchService searchService = SearchServiceFactory.getSearchService();
GetResponse<Index> response = searchService.getIndexes(
GetIndexesRequest.newBuilder());
for (Index index : response) {
index.getName();
index.getNamespace();
index.search("query");
}
SearchService is also responsible for creating new indexes. For
example:
SearchService searchService = SearchServiceFactory.getSearchService();
Index index = searchService.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. |
GetResponse<Index> |
getIndexes(GetIndexesRequest.Builder builder)
Gets the indexes specified in the request built from the builder. |
GetResponse<Index> |
getIndexes(GetIndexesRequest request)
Gets the indexes specified. |
java.util.concurrent.Future<GetResponse<Index>> |
getIndexesAsync(GetIndexesRequest.Builder builder)
Gets the indexes asynchronously for those specified in the request built from the builder. |
java.util.concurrent.Future<GetResponse<Index>> |
getIndexesAsync(GetIndexesRequest request)
Gets the indexes requested asynchronously. |
java.lang.String |
getNamespace()
Returns the namespace associated with this search service. |
ListIndexesResponse |
listIndexes(ListIndexesRequest request)
Deprecated. in 1.7.3. Use getIndexes(GetIndexesRequest) instead |
java.util.concurrent.Future<ListIndexesResponse> |
listIndexesAsync(ListIndexesRequest request)
Deprecated. in 1.7.3. Use getIndexesAsync(GetIndexesRequest) instead |
| 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()
@Deprecated ListIndexesResponse listIndexes(ListIndexesRequest request)
getIndexes(GetIndexesRequest) instead
Index.
// Get the SearchService for the default namespace
SearchService searchService = SearchServiceFactory.newSearchService();
// List the first page of indexes available and retrieve schemas
ListIndexesResponse response = searchService.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 indexes@Deprecated java.util.concurrent.Future<ListIndexesResponse> listIndexesAsync(ListIndexesRequest request)
getIndexesAsync(GetIndexesRequest) instead
request - a request specifying which indexes to list
Future that will allow getting a
ListIndexesResponse containing a list of existing indexesGetResponse<Index> getIndexes(GetIndexesRequest request)
Index.
// Get the SearchService for the default namespace SearchService searchService = SearchServiceFactory.newSearchService(); // Get the first page of indexes available and retrieve schemas GetResponseresponse = searchService.getIndexes( GetIndexesRequest.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 get
GetResponse containing list of existing indexes
GetException - if there is a failure in the search service
getting indexesGetResponse<Index> getIndexes(GetIndexesRequest.Builder builder)
builder.
builder - a builder to be used to construct a GetIndexesRequest
specifying which indexes to get
GetResponse containing list of existing indexesjava.util.concurrent.Future<GetResponse<Index>> getIndexesAsync(GetIndexesRequest request)
request - a request specifying which indexes to get
Future that will allow getting a
GetResponse containing a list of existing indexesjava.util.concurrent.Future<GetResponse<Index>> getIndexesAsync(GetIndexesRequest.Builder builder)
builder.
builder - a builder to be used to construct a GetIndexesRequest
specifying which indexes to get
Future that will allow getting a
GetResponse containing a list of existing indexes
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||