feat: use trigram index on objectid for improved search - BED-9103 - #3206
Draft
StranDutton wants to merge 2 commits into
Draft
feat: use trigram index on objectid for improved search - BED-9103#3206StranDutton wants to merge 2 commits into
StranDutton wants to merge 2 commits into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Updates raw ObjectID fuzzy and prefix search to use DAWGS' upcoming indexable case-insensitive predicates when the
use_raw_object_idfeature flag is enabled.Adds an ObjectID text-search index to the graph schema so PostgreSQL can efficiently search both
NameandObjectIDfrom the shared Search/Explore input.Exact ObjectID matching remains case-sensitive. Flag-off search behavior is unchanged.
This PR depends on a related DAWGS PR
Caution
The Dawgs version must be updated after the related PR is merged.
Motivation and Context
Resolves BED-9103
The raw objectIDs feature flag preserves source casing. Fuzzy and prefix search must therefore be case-insensitive while still searching both
NameandObjectID.The existing raw-ObjectID fuzzy and prefix query shape scans graph nodes because its PostgreSQL helpers use
strposandleftrather thanILIKE, preventing PostgreSQL from using trigram indexes. ObjectID has an exact-match B-tree index but no text-search index for fuzzy or prefix matching.This change enables an indexable query shape for the feature-flagged raw ObjectID search path and adds the missing ObjectID text-search index.
No Goose migration is needed. The ObjectID text-search index is declared in the Dawgs graph schema and is created when graph schema assertion runs.
Caution
Production rollout must ensure the updated graph schema is asserted so the index is created. Dawgs currently uses ordinary index creation, not
CREATE INDEX CONCURRENTLY.How Has This Been Tested?
Focused BHE query and graph-schema tests were run using a temporary workspace with the local Dawgs checkout.
Manual
PostgreSQL EXPLAIN (ANALYZE, BUFFERS)benchmarks were run against a local GitHub graph containing 38,655 nodes:BitmapOrtrigram-index plan, ~5.7 ms.BitmapOrtrigram-index plan, ~6.5 ms.The authenticated
/api/v2/searchendpoint was also exercised withuse_raw_object_idenabled. Warm requests completed in approximately 6-7 ms.Types of Changes
Checklist
I have met the contributing prerequisites
I have ensured that related documentation is up-to-date