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

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

The search package provides an API for indexing documents and retrieving them using search queries.

See:
Description

Interface Summary
Index | An Index allows synchronous adding and deleting of `Documents` as well as synchronous searching for Documents.
IndexManager | A manager capable of listing available indexes, which can be queried about their metadata or have index/delete/search operations performed on them.
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 | Represents a result of adding a list of `Document` to the index.
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 or date.
Field.Builder | A field builder.
FieldExpression | Represents an expression bound to a returned Field with the given name.
FieldExpression.Builder | A field expression builder.
IndexManagerFactory | An factory that creates default implementation of `IndexManager`.
IndexSpec | Represents information about an index.
IndexSpec.Builder | A builder of IndexSpec.
ListDocumentsRequest | A request to list documents in an index.
ListDocumentsRequest.Builder | The builder of `ListDocumentsRequest`s.
ListDocumentsResponse | Represents a result of executing a `ListDocumentsRequest`.
ListIndexesRequest | A request to list indexes.
ListIndexesRequest.Builder | The builder of `ListIndexesRequest`s.
ListIndexesResponse | Represents a result of executing a `ListIndexesRequest`.
OperationResult | The result of an operation involving the search service.
ParserFactory | A factory which produces `QueryParsers` for a given token rewrite stream.
Schema | Contains information about the kinds of document `Fields` which are supported by the `Index`.
SearchRequest | A request to search an index for documents which match a query, restricting the document fields returned to those given, and scoring and sorting the results, whilst supporting pagination.
SearchRequest.Builder | A builder which constructs SearchRequest objects.
SearchResponse | Represents a result of executing a `SearchRequest`.
SearchResult | Represents a single search result consisting of a scored document, a cursor to continue the search from, and any expression fields.
SearchServiceFactory | An factory that creates default implementation of `SearchService`.
SortSpec | Sorting specification for a single dimension.
SortSpec.Builder | A builder that constructs `SortSpecs`.
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.
SearchRequest.CursorType | Use a cursor returned from a previous set of search results as a starting point to retrieve the next set of results.
SortSpec.SortDirection | The direction search results are sorted by, either ascending or descending.
SortSpec.SortType | The type of sorting to order documents in a search.
StatusCode | Status code returned by various index operations.

Exception Summary
AddDocumentsException | Thrown to indicate that a search service failure occurred while adding documents to the index.
InternalFailureException | Thrown to indicate that a search service failure occurred.
ListDocumentsException | Thrown to indicate that a search service failure occurred while performing a list documents request.
ListIndexesException | Thrown to indicate that a search service failure occurred while listing indexes.
RemoveDocumentsException | Thrown to indicate that a search service failure occurred while deleting documents.
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.

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

The search package provides an API 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<Document> indexAndSearch(String query, Document... docs) {
         SearchService searchService = SearchServiceFactory.getSearchService();
         Index index = searchService.getIndex(
             IndexSpec.newBuilder()
                 .setIndexName("indexName")
                 .setConsistency(Consistency.PER_DOCUMENT)
                 .build());
         for (Document d : docs) {
           OperationResult result = index.addDocument(d);
           assert result.getCode().equals(StatusCode.OK);
         }
         SearchResponse response = index.search(query);
         List<Document> matched = new ArrayList<Document>(
             response.getDocumentsReturned());
         for (SearchResult result : response) {
           matched.add(result.getDocument());
         }
         return matched;
     }

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