Skip to content

Commit 0e925ba

Browse files
committed
documentation cleanup
1 parent 265178a commit 0e925ba

2 files changed

Lines changed: 49 additions & 18 deletions

File tree

handwritten/firestore/dev/src/pipelines/expression.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,7 +3153,7 @@ export abstract class Expression
31533153
*
31543154
* @remarks This Expression can only be used within a `Search` stage.
31553155
*
3156-
* @param rquery Define the search query using the search DTS (TODO(search) link).
3156+
* @param rquery Define the search query using the search DSL.
31573157
*/
31583158
snippet(rquery: string): Expression;
31593159

@@ -10356,7 +10356,7 @@ export function isType(
1035610356
* @remarks This Expression can only be used within a `Search` stage.
1035710357
*
1035810358
* @param searchField Search the specified field.
10359-
* @param rquery Define the search query using the search DTS.
10359+
* @param rquery Define the search query using the search DSL.
1036010360
*/
1036110361
export function matches(
1036210362
searchField: string | Field,
@@ -10382,7 +10382,7 @@ export function documentMatches(
1038210382

1038310383
/**
1038410384
* Evaluates to the search score that reflects the topicality of the document
10385-
* to all of the text predicates (`queryMatch`)
10385+
* to all the text predicates (for example: `documentMatches`)
1038610386
* in the search query. If `SearchOptions.query` is not set or does not contain
1038710387
* any text predicates, then this topicality score will always be `0`.
1038810388
*
@@ -10399,7 +10399,7 @@ export function score(): Expression {
1039910399
* @remarks This Expression can only be used within a `Search` stage.
1040010400
*
1040110401
* @param searchField Search the specified field for matching terms.
10402-
* @param rquery Define the search query using the search DTS (TODO(search) link).
10402+
* @param rquery Define the search query using the search DSL.
1040310403
*/
1040410404
export function snippet(
1040510405
searchField: string | Field,
@@ -10413,7 +10413,7 @@ export function snippet(
1041310413
* @remarks This Expression can only be used within a `Search` stage.
1041410414
*
1041510415
* @param searchField Search the specified field for matching terms.
10416-
* @param options Define the search query using the search DTS (TODO(search) link).
10416+
* @param options Define the search query using the search DSL.
1041710417
*/
1041810418
export function snippet(
1041910419
searchField: string | Field,

handwritten/firestore/types/firestore.d.ts

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5648,7 +5648,7 @@ declare namespace FirebaseFirestore {
56485648
*
56495649
* @remarks This Expression can only be used within a `Search` stage.
56505650
*
5651-
* @param rquery Define the search query using the search DTS (TODO(search) link).
5651+
* @param rquery Define the search query using the search DSL.
56525652
*/
56535653
snippet(rquery: string): Expression;
56545654

@@ -11460,30 +11460,45 @@ declare namespace FirebaseFirestore {
1146011460
* @remarks This Expression can only be used within a `Search` stage.
1146111461
*
1146211462
* @param searchField Search the specified field.
11463-
* @param rquery Define the search query using the search DTS.
11463+
* @param rquery Define the search query using the search DSL.
1146411464
*/
1146511465
export function matches(
1146611466
searchField: string | Field,
1146711467
rquery: string | Expression,
1146811468
): BooleanExpression;
1146911469

1147011470
/**
11471-
* Perform a full-text search on the document.
11471+
* Perform a full-text search on all indexed search fields in the document.
1147211472
*
1147311473
* @remarks This Expression can only be used within a `Search` stage.
1147411474
*
11475-
* @param rquery Define the search query using the rquery DTS.
11475+
* @example
11476+
* ```typescript
11477+
* db.pipeline().collection('restaurants').search({
11478+
* query: documentMatches('waffles OR pancakes')
11479+
* })
11480+
* ```
11481+
*
11482+
* @param rquery Define the search query using the search DSL.
1147611483
*/
1147711484
export function documentMatches(
1147811485
rquery: string | Expression,
1147911486
): BooleanExpression;
1148011487

1148111488
/**
1148211489
* Evaluates to the search score that reflects the topicality of the document
11483-
* to all of the text predicates (`queryMatch`)
11490+
* to all of the text predicates (for example: `documentMatches`)
1148411491
* in the search query. If `SearchOptions.query` is not set or does not contain
1148511492
* any text predicates, then this topicality score will always be `0`.
1148611493
*
11494+
* @example
11495+
* ```typescript
11496+
* db.pipeline().collection('restaurants').search({
11497+
* query: 'waffles',
11498+
* sort: score().descending()
11499+
* })
11500+
* ```
11501+
*
1148711502
* @remarks This Expression can only be used within a `Search` stage.
1148811503
*/
1148911504
export function score(): Expression;
@@ -11492,10 +11507,18 @@ declare namespace FirebaseFirestore {
1149211507
* Evaluates to an HTML-formatted text snippet that highlights terms matching
1149311508
* the search query in `<b>bold</b>`.
1149411509
*
11510+
* @example
11511+
* ```typescript
11512+
* db.pipeline().collection('restaurants').search({
11513+
* query: 'waffles',
11514+
* addFields: { snippet: snippet('menu', 'waffles') }
11515+
* })
11516+
* ```
11517+
*
1149511518
* @remarks This Expression can only be used within a `Search` stage.
1149611519
*
1149711520
* @param searchField Search the specified field for matching terms.
11498-
* @param rquery Define the search query using the search DTS (TODO(search) link).
11521+
* @param rquery Define the search query using the search DSL.
1149911522
*/
1150011523
export function snippet(
1150111524
searchField: string | Field,
@@ -11509,7 +11532,7 @@ declare namespace FirebaseFirestore {
1150911532
* @remarks This Expression can only be used within a `Search` stage.
1151011533
*
1151111534
* @param searchField Search the specified field for matching terms.
11512-
* @param options Define the search query using the search DTS (TODO(search) link).
11535+
* @param options Define the search query using the search DSL.
1151311536
*/
1151411537
export function snippet(
1151511538
searchField: string | Field,
@@ -11520,6 +11543,14 @@ declare namespace FirebaseFirestore {
1152011543
* Evaluates to the distance in meters between the location in the specified
1152111544
* field and the query location.
1152211545
*
11546+
* @example
11547+
* ```typescript
11548+
* db.pipeline().collection('restaurants').search({
11549+
* query: 'waffles',
11550+
* sort: geoDistance('location', new GeoPoint(37.0, -122.0)).ascending()
11551+
* })
11552+
* ```
11553+
*
1152311554
* @remarks This Expression can only be used within a `Search` stage.
1152411555
*
1152511556
* @param fieldName - Specifies the field in the document which contains
@@ -13118,11 +13149,11 @@ declare namespace FirebaseFirestore {
1311813149
* are supported in the Search query.
1311913150
*
1312013151
* @example
13121-
* ```
13152+
* ```typescript
1312213153
* db.pipeline().collection('restaurants').search({
1312313154
* query: or(
13124-
* documentContainsText("breakfast"),
13125-
* field('menu').containsText('waffle AND coffee')
13155+
* documentMatches("breakfast"),
13156+
* matches('menu', 'waffle AND coffee')
1312613157
* )
1312713158
* })
1312813159
* ```
@@ -13146,8 +13177,8 @@ declare namespace FirebaseFirestore {
1314613177
// TODO(search) add indexPartition after languageCode
1314713178

1314813179
/**
13149-
* The maximum number of documents for the search stage to score. Documents
13150-
* will be processed in the pre-sort order specified by the search index.
13180+
* The maximum number of documents to retrieve. Documents will be retrieved in the
13181+
* pre-sort order specified by the search index.
1315113182
*/
1315213183
retrievalDepth?: number;
1315313184

@@ -13190,7 +13221,7 @@ declare namespace FirebaseFirestore {
1319013221
*/
1319113222
export type SnippetOptions = {
1319213223
/**
13193-
* Define the search query using the search DTS.
13224+
* Define the search query using the search DSL.
1319413225
*/
1319513226
rquery: string;
1319613227

0 commit comments

Comments
 (0)