Skip to content

Commit 1c38943

Browse files
committed
add web geo and search sort snippet
1 parent 217cd9f commit 1c38943

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

firestore-next/test.firestore.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,4 +3601,25 @@ describe("firestore-pipelines", () => {
36013601
// [END pipeline_search_score]
36023602
console.log(result);
36033603
}
3604+
3605+
async function pipelineSearchSort() {
3606+
// [START pipeline_search_score_sort]
3607+
const result = await execute(db.pipeline().collection('restaurants')
3608+
.search({
3609+
query: documentMatches('waffles'),
3610+
sort: score().descending()
3611+
}));
3612+
// [END pipeline_search_score_sort]
3613+
console.log(result);
3614+
}
3615+
3616+
async function pipelineSearchGeospatial() {
3617+
// [START pipeline_search_geospatial]
3618+
const result = await execute(db.pipeline().collection('restaurants')
3619+
.search({
3620+
query: documentMatches('"belgian waffles"')
3621+
}));
3622+
// [END pipeline_search_geospatial]
3623+
console.log(result);
3624+
}
36043625
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-next/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START pipeline_search_geospatial_modular]
8+
const result = await execute(db.pipeline().collection('restaurants')
9+
.search({
10+
query: documentMatches('"belgian waffles"')
11+
}));
12+
// [END pipeline_search_geospatial_modular]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-next/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START pipeline_search_score_sort_modular]
8+
const result = await execute(db.pipeline().collection('restaurants')
9+
.search({
10+
query: documentMatches('waffles'),
11+
sort: score().descending()
12+
}));
13+
// [END pipeline_search_score_sort_modular]

0 commit comments

Comments
 (0)