Class Search
java.lang.Object
com.google.cloud.firestore.pipeline.stages.Stage
com.google.cloud.firestore.pipeline.stages.Search
The Search stage executes full-text search or geo search operations.
The Search stage must be the first stage in a Pipeline.
Example:
db.pipeline().collection("restaurants").search(
Search.withQuery(documentMatches("waffles OR pancakes"))
.withSort(score().descending())
.withLimit(10)
);
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionwithAddFields(Selectable field, Selectable... additionalFields) Specify the fields to add to each document.withLanguageCode(String value) Specify the BCP-47 language code of text in the search query, such as “en” or “sr”.withLimit(long limit) Specify the maximum number of documents to return from the `search` stage.withOffset(long offset) Specify the number of documents to skip from the beginning of the search result set.static SearchwithQuery(BooleanExpression query) CreateSearchwith an expression search query.static SearchCreateSearchwith an expression search query.withRetrievalDepth(long retrievalDepth) Specify the maximum number of documents to retrieve from the search index.Specify how the returned documents are sorted.Methods inherited from class com.google.cloud.firestore.pipeline.stages.Stage
toStageProto
-
Constructor Details
-
Search
@InternalApi public Search(com.google.cloud.firestore.pipeline.stages.InternalOptions options)
-
-
Method Details
-
withQuery
CreateSearchwith an expression search query.queryspecifies the search query that will be used to query and score documents by the search stage. -
withQuery
CreateSearchwith an expression search query.queryspecifies the search query that will be used to query and score documents by the search stage. -
withAddFields
Specify the fields to add to each document. -
withSort
Specify how the returned documents are sorted. One or more ordering are required. -
withLimit
Specify the maximum number of documents to return from the `search` stage. The `limit` is applied after documents are scored and sorted. -
withRetrievalDepth
Specify the maximum number of documents to retrieve from the search index. Documents will be retrieved in the pre-sort order specified by the search index. The `retrievalDepth` is a limit applied before documents are scored and sorted, which can reduce costs of expensive scoring and sorting operations. -
withOffset
Specify the number of documents to skip from the beginning of the search result set. -
withLanguageCode
Specify the BCP-47 language code of text in the search query, such as “en” or “sr”.
-