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 indexing 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.

Class Summary
DeleteDocumentsResponse | Represents the result of executing a `DeleteDocumentsResponse`.
Document | Represents a user generated document.
Document.Builder | A builder of documents.
DocumentChecker | Checks values of a Document.
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.
FieldChecker | Provides checks for Field names, language code, and values: text, HTML, atom or date.
FieldExpression | Represents an expression bound to a returned Field with the given name.
FieldExpression.Builder | A field expression builder.
IndexChecker | Checks values of `Indexes`.
IndexDocumentsResponse | Represents a result of executing a `IndexDocumentsResponse`.
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.
ListDocumentsRequestChecker | Checks values of `ListDocumentsParams`.
ListDocumentsResponse | Represents a result of executing a `ListDocumentsRequest`.
ListIndexesRequest | A request to list indexes.
ListIndexesRequest.Builder | The builder of `ListIndexesRequest`s.
ListIndexesRequestChecker | Checks values of `ListIndexesRequest`.
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.
Preconditions | Simple static methods to be called at the start of your own methods to verify correct arguments and state.
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.
SearchRequestChecker | Checks values of SearchRequests.
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.
SortSpec | Sorting specification for a single dimension.
SortSpec.Builder | A builder that constructs `SortSpecs`.
SortSpecChecker | Checks the values of a `SortSpec`.
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.SortType | The type of sorting to order documents in a search.
StatusCode | Status code returned by various index operations.

Exception Summary
DeleteDocumentsException | Thrown to indicate that a search service failure occurred while deleting documents.
IndexDocumentsException | Thrown to indicate that a search service failure occurred while indexing documents.
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.
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) {
         IndexManager indexManager = IndexManagerFactory.newIndexManager();
         Index index = indexManager.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());
         if (StatusCode.OK.equals(response.getOperationResult().getCode())) {
             for (SearchResult result : response) {
                 matched.add(result.getDocument());
             }
         }
         return matched;
     }

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