Skip to content

feat: Support creating search indexes for Firestore#10431

Open
rwhogg wants to merge 1 commit intomainfrom
search-index-support
Open

feat: Support creating search indexes for Firestore#10431
rwhogg wants to merge 1 commit intomainfrom
search-index-support

Conversation

@rwhogg
Copy link
Copy Markdown
Contributor

@rwhogg rwhogg commented Apr 29, 2026

Description

Adds support for creating Firestore search indexes

Scenarios Tested

Tested search configs with and without other existing index field types.

Sample Commands

firebase deploy --only firestore

@rwhogg rwhogg requested a review from NickChittle April 29, 2026 18:55
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 introduces support for searchConfig in Firestore indexes, encompassing API type definitions, sorting logic, validation, and pretty-printing. The feedback focuses on improving code robustness and adhering to project standards. Specifically, it is recommended to use optional chaining when accessing index fields to prevent potential runtime errors, implement a more deterministic comparison logic for searchConfig instead of relying on JSON.stringify, remove the use of the any type in accordance with the style guide, and add explicit validation for optional configuration fields.

Comment thread src/firestore/api.ts Outdated
Comment thread src/firestore/api-sort.ts Outdated
Comment thread src/firestore/api.ts Outdated
Comment thread src/firestore/api.ts
@rwhogg rwhogg force-pushed the search-index-support branch 2 times, most recently from ad5b5ad to a673eeb Compare May 4, 2026 14:41
Comment thread src/firestore/api-sort.spec.ts Outdated
},
],
};
const indexWithSearch2: any = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use a specific type instead of any - is there a reason we can't just use index here?

Applies throughout

Comment thread src/firestore/api.ts
if (lastField.vectorConfig) {
// lastField is vector field, refer to the second from last field
const vectorField = lastField;
if (lastField?.searchConfig || lastField?.vectorConfig) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now that we have 2 special types, can both show up in the same index? If so, i think this logic might be broken

Comment thread src/firestore/api.ts Outdated
Comment thread src/firestore/api.ts Outdated
@rwhogg rwhogg force-pushed the search-index-support branch 2 times, most recently from c5da14f to 8b9c243 Compare May 5, 2026 15:00
@rwhogg rwhogg force-pushed the search-index-support branch from 8b9c243 to c6250b9 Compare May 5, 2026 17:19
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.

3 participants