public final class Search extends StageThe 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)
);
Static Methods
withQuery(BooleanExpression query)
public static Search withQuery(BooleanExpression query)Create Search with an expression search query.
query specifies the search query that will be used to query and score documents by
the search stage.
| Parameter | |
|---|---|
| Name | Description |
query |
BooleanExpression |
| Returns | |
|---|---|
| Type | Description |
Search |
|
withQuery(String rquery)
public static Search withQuery(String rquery)Create Search with an expression search query.
query specifies the search query that will be used to query and score documents by
the search stage.
| Parameter | |
|---|---|
| Name | Description |
rquery |
String |
| Returns | |
|---|---|
| Type | Description |
Search |
|
Constructors
Search(InternalOptions options)
public Search(InternalOptions options)| Parameter | |
|---|---|
| Name | Description |
options |
com.google.cloud.firestore.pipeline.stages.InternalOptions |
Methods
withAddFields(Selectable field, Selectable[] additionalFields)
public Search withAddFields(Selectable field, Selectable[] additionalFields)Specify the fields to add to each document.
| Parameters | |
|---|---|
| Name | Description |
field |
Selectable |
additionalFields |
Selectable[] |
| Returns | |
|---|---|
| Type | Description |
Search |
|
withRetrievalDepth(long retrievalDepth)
public Search withRetrievalDepth(long retrievalDepth)Specify the maximum number of documents to retrieve. Documents will be retrieved in the pre-sort order specified by the search index.
| Parameter | |
|---|---|
| Name | Description |
retrievalDepth |
long |
| Returns | |
|---|---|
| Type | Description |
Search |
|
withSort(Ordering order, Ordering[] additionalOrderings)
public Search withSort(Ordering order, Ordering[] additionalOrderings)Specify how the returned documents are sorted. One or more ordering are required.
| Parameters | |
|---|---|
| Name | Description |
order |
Ordering |
additionalOrderings |
Ordering[] |
| Returns | |
|---|---|
| Type | Description |
Search |
|