Skip to content

feat(firestore): pipeline search#16469

Open
daniel-sanche wants to merge 17 commits intomainfrom
firestore_pipelines_search
Open

feat(firestore): pipeline search#16469
daniel-sanche wants to merge 17 commits intomainfrom
firestore_pipelines_search

Conversation

@daniel-sanche
Copy link
Copy Markdown
Contributor

@daniel-sanche daniel-sanche commented Mar 27, 2026

Implements Search functionality:

  • new search stage
  • between expression (as alias for And(GreaterThanOrEqual(x), LessThanOrEqual(y))
  • geo_distance expression (for use in search stages only)
  • Score() expression (for use in search stages only)
  • SocumentMatches expression (for use in search stages only)

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.

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()

@daniel-sanche daniel-sanche marked this pull request as ready for review March 31, 2026 18:03
@daniel-sanche daniel-sanche requested review from a team as code owners March 31, 2026 18:03
@daniel-sanche daniel-sanche changed the title [DRAFT] feat(firestore): pipeline search feat(firestore): pipeline search Mar 31, 2026
select (Optional[Sequence[Selectable | str]]): The fields to keep or add to each document,
specified as an array of `Selectable` or strings.
offset (Optional[int]): The number of documents to skip.
query_enhancement (Optional[str | QueryEnhancement]): Define the query expansion behavior used by full-text search expressions
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we need to mention here that "preferred" is the default value if none provided?

@bhshkh
Copy link
Copy Markdown

bhshkh commented Apr 2, 2026

I saw something called snippet in code samples https://docs.google.com/document/d/164LK_QblqnsM3kAXqWsNAouOinhmBUgu2mPbTDVlA30/edit?tab=t.0#heading=h.hso4h1r9trkp

Will that be included in subsequent PR ?

@daniel-sanche
Copy link
Copy Markdown
Contributor Author

daniel-sanche commented Apr 2, 2026

There's a spot in the doc that says "Scope estimates for Next", listing snippets as being out of scope for the initial release

I also confirmed this through the Next26 chat

Copy link
Copy Markdown

@bhshkh bhshkh left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants