Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit e4e308e

Browse files
committed
Formatting
1 parent fc16d5a commit e4e308e

3 files changed

Lines changed: 677 additions & 687 deletions

File tree

google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/stages/Search.java

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,24 @@ public Search withAddFields(Selectable field, Selectable... additionalFields) {
119119
return new Search(options.with("add_fields", encodeValue(map)));
120120
}
121121

122-
// TODO(search) enable with backend support
123-
// /** Specify the fields to keep or add to each document. */
124-
// public Search withSelect(Selectable selection, Object... additionalSelections) {
125-
// Selectable[] allSelections = new Selectable[additionalSelections.length + 1];
126-
// allSelections[0] = selection;
127-
// for (int i = 0; i < additionalSelections.length; i++) {
128-
// allSelections[i + 1] = Selectable.toSelectable(additionalSelections[i]);
129-
// }
130-
// Map<String, Value> map =
131-
// PipelineUtils.selectablesToMap(allSelections).entrySet().stream()
132-
// .collect(Collectors.toMap(Map.Entry::getKey, e -> encodeValue(e.getValue())));
133-
// return new Search(options.with("select", encodeValue(map)));
134-
// }
135-
136-
// /** Specify the fields to keep or add to each document. */
137-
// public Search withSelect(String fieldName, Object... additionalSelections) {
138-
// return withSelect(field(fieldName), additionalSelections);
139-
// }
122+
// TODO(search) enable with backend support
123+
// /** Specify the fields to keep or add to each document. */
124+
// public Search withSelect(Selectable selection, Object... additionalSelections) {
125+
// Selectable[] allSelections = new Selectable[additionalSelections.length + 1];
126+
// allSelections[0] = selection;
127+
// for (int i = 0; i < additionalSelections.length; i++) {
128+
// allSelections[i + 1] = Selectable.toSelectable(additionalSelections[i]);
129+
// }
130+
// Map<String, Value> map =
131+
// PipelineUtils.selectablesToMap(allSelections).entrySet().stream()
132+
// .collect(Collectors.toMap(Map.Entry::getKey, e -> encodeValue(e.getValue())));
133+
// return new Search(options.with("select", encodeValue(map)));
134+
// }
135+
136+
// /** Specify the fields to keep or add to each document. */
137+
// public Search withSelect(String fieldName, Object... additionalSelections) {
138+
// return withSelect(field(fieldName), additionalSelections);
139+
// }
140140

141141
/** Specify how the returned documents are sorted. One or more ordering are required. */
142142
public Search withSort(Ordering order, Ordering... additionalOrderings) {
@@ -147,11 +147,11 @@ public Search withSort(Ordering order, Ordering... additionalOrderings) {
147147
options.with("sort", Lists.transform(Arrays.asList(allOrderings), Ordering::toProto)));
148148
}
149149

150-
// TODO(search) enable with backend support
151-
// /** Specify the maximum number of documents to return from the Search stage. */
152-
// public Search withLimit(long limit) {
153-
// return new Search(options.with("limit", encodeValue(limit)));
154-
// }
150+
// TODO(search) enable with backend support
151+
// /** Specify the maximum number of documents to return from the Search stage. */
152+
// public Search withLimit(long limit) {
153+
// return new Search(options.with("limit", encodeValue(limit)));
154+
// }
155155

156156
/**
157157
* Specify the maximum number of documents to retrieve. Documents will be retrieved in the
@@ -162,25 +162,27 @@ public Search withRetrievalDepth(long retrievalDepth) {
162162
}
163163

164164
// TODO(search) enable with backend support
165-
// /** Specify the number of documents to skip. */
166-
// public Search withOffset(long offset) {
167-
// return new Search(options.with("offset", encodeValue(offset)));
168-
// }
169-
170-
// TODO(search) enable with backend support
171-
// /** Specify the BCP-47 language code of text in the search query, such as, “en-US” or “sr-Latn” */
172-
// public Search withLanguageCode(String value) {
173-
// return new Search(options.with("language_code", encodeValue(value)));
174-
// }
165+
// /** Specify the number of documents to skip. */
166+
// public Search withOffset(long offset) {
167+
// return new Search(options.with("offset", encodeValue(offset)));
168+
// }
169+
170+
// TODO(search) enable with backend support
171+
// /** Specify the BCP-47 language code of text in the search query, such as, “en-US” or
172+
// “sr-Latn” */
173+
// public Search withLanguageCode(String value) {
174+
// return new Search(options.with("language_code", encodeValue(value)));
175+
// }
175176

176177
// TODO(search) enable with backend support
177-
// /**
178-
// * Specify the query expansion behavior used by full-text search expressions in this search stage.
179-
// * Default: {@code .PREFERRED}
180-
// */
181-
// public Search withQueryEnhancement(QueryEnhancement queryEnhancement) {
182-
// return new Search(options.with("query_enhancement", queryEnhancement.toProto()));
183-
// }
178+
// /**
179+
// * Specify the query expansion behavior used by full-text search expressions in this search
180+
// stage.
181+
// * Default: {@code .PREFERRED}
182+
// */
183+
// public Search withQueryEnhancement(QueryEnhancement queryEnhancement) {
184+
// return new Search(options.with("query_enhancement", queryEnhancement.toProto()));
185+
// }
184186

185187
@Override
186188
Iterable<Value> toStageArgs() {

google-cloud-firestore/src/test/java/com/google/cloud/firestore/PipelineProtoTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ public void testSearchStageProtoEncoding() {
4545
.collection("foo")
4646
.search(
4747
Search.withQuery("foo")
48-
// .withLimit(1)
48+
// .withLimit(1)
4949
.withRetrievalDepth(2)
50-
// .withOffset(3)
51-
// .withQueryEnhancement(Search.QueryEnhancement.REQUIRED)
52-
// .withLanguageCode("en-US")
50+
// .withOffset(3)
51+
// .withQueryEnhancement(Search.QueryEnhancement.REQUIRED)
52+
// .withLanguageCode("en-US")
5353
.withSort(field("foo").ascending())
5454
.withAddFields(constant(true).as("bar")));
55-
// .withSelect(field("id")));
55+
// .withSelect(field("id")));
5656

5757
com.google.firestore.v1.Pipeline protoPipeline = pipeline.toProto();
5858
assertThat(protoPipeline.getStagesCount()).isEqualTo(2);
@@ -73,24 +73,24 @@ public void testSearchStageProtoEncoding() {
7373
assertThat(query.getFunctionValue().getArgs(0).getStringValue()).isEqualTo("foo");
7474

7575
// limit
76-
// assertThat(optionsMap.get("limit").getIntegerValue()).isEqualTo(1L);
76+
// assertThat(optionsMap.get("limit").getIntegerValue()).isEqualTo(1L);
7777

7878
// retrieval_depth
7979
assertThat(optionsMap.get("retrieval_depth").getIntegerValue()).isEqualTo(2L);
8080

8181
// offset
82-
// assertThat(optionsMap.get("offset").getIntegerValue()).isEqualTo(3L);
82+
// assertThat(optionsMap.get("offset").getIntegerValue()).isEqualTo(3L);
8383

8484
// query_enhancement
85-
// assertThat(optionsMap.get("query_enhancement").getStringValue()).isEqualTo("required");
85+
// assertThat(optionsMap.get("query_enhancement").getStringValue()).isEqualTo("required");
8686

8787
// language_code
88-
// assertThat(optionsMap.get("language_code").getStringValue()).isEqualTo("en-US");
88+
// assertThat(optionsMap.get("language_code").getStringValue()).isEqualTo("en-US");
8989

9090
// select
91-
// Value select = optionsMap.get("select");
92-
// assertThat(select.getMapValue().getFieldsMap().get("id").getFieldReferenceValue())
93-
// .isEqualTo("id");
91+
// Value select = optionsMap.get("select");
92+
// assertThat(select.getMapValue().getFieldsMap().get("id").getFieldReferenceValue())
93+
// .isEqualTo("id");
9494

9595
// sort
9696
Value sort = optionsMap.get("sort");

0 commit comments

Comments
 (0)