Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.google.appengine.api.search

Provides a service for indexing documents and retrieving them using search queries.

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 list available indexes, which can be queried about their metadata or have index/delete/search operations performed on them.

Class Summary
AddDocumentsResponse | Deprecated. As of 1.6.5, replaced by `AddResponse`.
AddResponse | Represents a result of adding a list of objects (documents or queries) to an index.
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.
IndexSpec | Represents information about an index.
IndexSpec.Builder | A builder of IndexSpec.
ListIndexesRequest | A request to list indexes.
ListIndexesRequest.Builder | The builder of `ListIndexesRequest`s.
ListIndexesResponse | Represents a result of executing a `ListIndexesRequest`.
ListRequest | A request to list objects in an index.
ListRequest.Builder | The builder of `ListRequest`s.
ListResponse<T> | Represents a result of executing a `ListRequest`.
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.
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 | Supported consistency modes by indexes.
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
AddDocumentsException | Deprecated. As of 1.6.5, replaced by `AddException`.
AddException | Thrown to indicate that a search service failure occurred while adding objects to the index.
InternalFailureException | Deprecated. As of 1.7.1, replaced by `SearchServiceException`.
ListDocumentsException | Deprecated. As of 1.6.6, replaced by `ListException`.
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.
RemoveDocumentsException | Deprecated. As of 1.6.5, replaced by `RemoveException`.
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.

## Package com.google.appengine.api.search Description

Provides a service for indexing documents and retrieving them using search queries. This is a low-level API that allows users to directly create `Document`s which can be indexed and retrieved with the help of `Index`.

A `Document` is a collection of `Field`s. 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 added to 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")
                 .setConsistency(Consistency.PER_DOCUMENT)
                 .build());
         for (Document document : documents) {
           AddResponse response = index.add(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;
     }

See Also:
  `SearchServiceFactory`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES