|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Interface Summary | |
|---|---|
| Index | An Index allows synchronous and asynchronous adding and deleting of
Documents as well as synchronous and asynchronous
searching for Documents for a given Query. |
| 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. |
| Class Summary | |
|---|---|
| AddResponse | Deprecated. as of 1.7.3. |
| Cursor | Represents a cursor on the set of results found for executing a Query
during a search on the Index. |
| Cursor.Builder | A builder which constructs Cursor objects. |
| DateUtil | A utility class that centralizes processing of dates. |
| Document | Represents a user generated document. |
| Document.Builder | A builder of documents. |
| ExpressionTreeBuilder | A generator of AST representation of an expression. |
| Field | Represents a field of a Document, which is a name, an optional
locale, and at most one value: text, HTML, atom, date or GeoPoint. |
| Field.Builder | A field builder. |
| FieldExpression | Represents an expression bound to a returned Field with the given name. |
| FieldExpression.Builder | A field expression builder. |
| GeoPoint | Represents a point on the Earth's surface, in latitude and longitude coordinates. |
| GetIndexesRequest | A request to get a range of indexes. |
| GetIndexesRequest.Builder | The builder of GetIndexesRequests. |
| GetRequest | A request to list objects in an index. |
| GetRequest.Builder | The builder of GetRequests. |
| GetResponse<T> | Represents a result of executing a GetRequest. |
| IndexSpec | Represents information about an index. |
| IndexSpec.Builder | A builder of IndexSpec. |
| ListIndexesRequest | A request to list indexes. |
| ListIndexesRequest.Builder | The builder of ListIndexesRequests. |
| ListIndexesResponse | Deprecated. as of 1.7.3. |
| ListRequest | Deprecated. as of 1.7.3. |
| ListRequest.Builder | The builder of ListRequests. |
| ListResponse<T> | Deprecated. as of 1.7.3. |
| MatchScorer | Assigns a document score based on term frequency. |
| MatchScorer.Builder | A builder that constructs MatchScorers. |
| OperationResult | The result of an operation involving the search service. |
| PutResponse | Represents a result of putting a list of objects (documents or queries) into an index. |
| Query | A query to search an index for documents which match, restricting the document fields returned to those given, and scoring and sorting the results, whilst supporting pagination. |
| Query.Builder | A builder which constructs Query objects. |
| QueryOptions | Represents options which control where and what in the search results to return, from restricting the document fields returned to those given, and scoring and sorting the results, whilst supporting pagination. |
| QueryOptions.Builder | A builder which constructs QueryOptions objects. |
| RescoringMatchScorer | Assigns a document score based on term frequency weighted on document parts. |
| RescoringMatchScorer.Builder | A builder that constructs RescoringMatchScorers. |
| Results<T> | Represents a result of executing a search. |
| Schema | Contains information about the kinds of document Fields
which are supported by the Index. |
| Schema.Builder | A builder which constructs Schema objects. |
| ScoredDocument | Represents a document which may have been scored, possibly some computed expression fields, and a cursor to continue the search from. |
| ScoredDocument.Builder | A builder of scored documents. |
| SearchServiceFactory | An factory that creates default implementation of SearchService. |
| SortExpression | Sorting specification for a single dimension. |
| SortExpression.Builder | A builder that constructs SortExpressions. |
| SortOptions | Definition of how to sort documents. |
| SortOptions.Builder | A builder that constructs SortOptionss. |
| Util | A utility class that does various checks on search and indexing parameters. |
| Enum Summary | |
|---|---|
| Consistency | Deprecated. As of 1.7.3. |
| Field.FieldType | The type of the field value. |
| SortExpression.SortDirection | The direction search results are sorted by, either ascending or descending. |
| StatusCode | Status code returned by various index operations. |
| Exception Summary | |
|---|---|
| AddException | Deprecated. as of 1.7.3. |
| DeleteException | Thrown to indicate that a search service failure occurred while deleting objects. |
| GetException | Thrown to indicate that a search service failure occurred while performing a request to get requested objects. |
| ListException | Thrown to indicate that a search service failure occurred while performing a request to list elements of an index. |
| ListIndexesException | Thrown to indicate that a search service failure occurred while listing indexes. |
| PutException | Thrown to indicate that a search service failure occurred while putting objects into the index. |
| RemoveException | Thrown to indicate that a search service failure occurred while removing objects. |
| SearchBaseException | Thrown to indicate that a search service failure occurred. |
| SearchException | Thrown to indicate that a search service failure occurred while performing a search request. |
| SearchQueryException | Thrown to indicate that a search query was invalid. |
| SearchServiceException | Thrown to indicate that a search service failure occurred. |
Provides a service for indexing documents and retrieving them using
search queries. This is a low-level API that allows users to
directly create Documents which can be indexed and
retrieved with the help of Index.
A Document is a collection of Fields. Each field
is a named and typed value. A document is uniquely identified by
its ID and may contain zero or more fields. A field with a given
name can have multiple occurrences. Once documents are put into the
Index, they can be retrieved via search queries. Typically,
a program creates an index. This operation does nothing if the
index was already created. Next, a number of documents are inserted
into the index. Finally, index is searched and matching documents,
or their snippets are returned to the user.
public List<ScoredDocument> indexAndSearch(
String query, Document... documents) {
SearchService searchService = SearchServiceFactory.getSearchService();
Index index = searchService.getIndex(
IndexSpec.newBuilder().setIndexName("indexName"));
for (Document document : documents) {
PutResponse response = index.put(document);
assert response.getResults().get(0).getCode().equals(StatusCode.OK);
}
Results<ScoredDocument> results =
index.search(Query.newBuilder().build(query));
List<ScoredDocument> matched = new ArrayList<ScoredDocument>(
results.getNumberReturned());
for (ScoredDocument result : results) {
matched.add(result);
}
return matched;
}
SearchServiceFactory
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||