Skip to content

[DRAFT] feat(firestore): pipeline search#16469

Draft
daniel-sanche wants to merge 12 commits intomainfrom
firestore_pipelines_search
Draft

[DRAFT] feat(firestore): pipeline search#16469
daniel-sanche wants to merge 12 commits intomainfrom
firestore_pipelines_search

Conversation

@daniel-sanche
Copy link
Copy Markdown
Contributor

WIP

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements full-text search functionality for Firestore pipelines, adding a new search stage along with SearchOptions and supporting expressions like between, geo_distance, and document_matches. The changes include updates to the base pipeline, expression definitions, and stage logic, supported by new system and unit tests. Review feedback recommends expanding type hints for the between method to include integers and simplifying the Search stage's protobuf serialization by removing a redundant null check.


@expose_as_static
def between(
self, lower: Expression | float, upper: Expression | float
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The type hint for lower and upper is Expression | float, which is too restrictive. The docstring example uses integers (Field.of("age").between(18, 65)), which would be flagged as a type error by some static analysis tools. To more accurately reflect the supported types and align with the example, consider widening the type hint to include int.

Suggested change
self, lower: Expression | float, upper: Expression | float
self, lower: Expression | int | float, upper: Expression | int | float

Comment on lines +517 to +518
if self.options.query is not None:
options["query"] = self.options.query._to_pb()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The query parameter in SearchOptions.__init__ is not optional, and the initializer ensures self.options.query is always a BooleanExpression. Therefore, this if check for None is redundant and can be removed to simplify the code.

        options["query"] = self.options.query._to_pb()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant