Skip to content

Commit 984fe81

Browse files
committed
add example to docstring
1 parent 6d50577 commit 984fe81

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/google-cloud-firestore/google/cloud/firestore_v1/base_pipeline.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,19 @@ def search(self, options: stages.SearchOptions) -> "_BasePipeline":
350350
351351
This stage filters documents based on the provided query expression.
352352
353+
Example:
354+
>>> from google.cloud.firestore_v1.pipeline_stages import SearchOptions
355+
>>> from google.cloud.firestore_v1.pipeline_expressions import And, DocumentMatches, Field, GeoPoint
356+
>>> # Search for restaurants matching "waffles" within 1000m of a location
357+
>>> pipeline = client.pipeline().collection("restaurants").search(
358+
... SearchOptions(
359+
... query=And(
360+
... DocumentMatches("waffles"),
361+
... Field.of("location").geo_distance(GeoPoint(38.9, -107.0)).less_than(1000)
362+
... )
363+
... )
364+
... )
365+
353366
Args:
354367
options: A SearchOptions instance configuring the search.
355368

0 commit comments

Comments
 (0)