Skip to content

⚡ Bolt: Add itemPathBitflags for fuzzy matching early exit#585

Merged
AhmmedSamier merged 1 commit into
masterfrom
bolt-item-path-bitflags-9245149041969347036
Jul 18, 2026
Merged

⚡ Bolt: Add itemPathBitflags for fuzzy matching early exit#585
AhmmedSamier merged 1 commit into
masterfrom
bolt-item-path-bitflags-9245149041969347036

Conversation

@AhmmedSamier

@AhmmedSamier AhmmedSamier commented Jul 17, 2026

Copy link
Copy Markdown
Owner

💡 What: Added an itemPathBitflags parallel array to the SearchEngine. It calculates and stores the character bitmask specifically for the relativeFilePath property. The tryFuzzyMatchPath method now uses this bitmask to perform an O(1) early-exit check before running the expensive fuzzysort algorithm.
🎯 Why: Previously, tryFuzzyMatchPath had to run the fuzzysort algorithm on paths even if they didn't contain the necessary characters, as long as the overall item passed the aggregate itemBitflags check (which could happen if the missing characters existed in the name or fullName). This avoids executing expensive regex and array allocations for paths that definitely won't match.
📊 Impact: Reduces CPU cycles spent on fuzzysort by quickly discarding paths that do not contain all the query characters.
🔬 Measurement: Verified by running all unit tests in the language-server which confirm that the search engine still returns accurate results while benefiting from the early-exit optimization.


PR created automatically by Jules for task 9245149041969347036 started by @AhmmedSamier

Summary by CodeRabbit

  • Bug Fixes

    • Improved fuzzy search filtering for file paths, reducing incorrect matches caused by overly broad eligibility checks.
  • Performance

    • Optimized search readiness checks so path matching avoids unnecessary fuzzy evaluations, making searches more efficient while preserving results.

Introduced `itemPathBitflags` parallel array in the `SearchEngine` to allow for O(1) early-exit checks when performing fuzzy matches on the path property. This skips the expensive `Fuzzysort.single` algorithm for paths that don't contain the characters in the query bitmask.

Co-authored-by: AhmmedSamier <[email protected]>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c61ddebc-f35d-4fe7-be54-d5b9d172099d

📥 Commits

Reviewing files that changed from the base of the PR and between 124aa21 and b0cc2b7.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • language-server/src/core/search-engine.ts

📝 Walkthrough

Walkthrough

SearchEngine now maintains path-specific bitflags for each indexed item, computes them from relativeFilePath, and uses them to skip impossible path fuzzy matches before invoking Fuzzysort.

Changes

Path bitflag search optimization

Layer / File(s) Summary
Path bitflag storage and computation
language-server/src/core/search-engine.ts
Adds itemPathBitflags, computes pathFlags, incorporates them into aggregate flags, and keeps the array synchronized during item updates, clearing, and cache accounting.
Path fuzzy-match eligibility gating
language-server/src/core/search-engine.ts, .jules/bolt.md
Passes path bitflags into search context and skips Fuzzysort when path query flags cannot match; documents the optimization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding itemPathBitflags to support fuzzy-matching early exit.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-item-path-bitflags-9245149041969347036

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AhmmedSamier AhmmedSamier reopened this Jul 18, 2026
@AhmmedSamier
AhmmedSamier merged commit ddaf186 into master Jul 18, 2026
11 checks passed
@AhmmedSamier
AhmmedSamier deleted the bolt-item-path-bitflags-9245149041969347036 branch July 18, 2026 00:22
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