Normalize component search tokens for better matching#2424
Open
Mbeaulne wants to merge 2 commits into
Open
Conversation
🎩 PreviewA preview build has been created at: |
8 tasks
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
8 tasks
This was referenced Jun 18, 2026
Mbeaulne
commented
Jun 18, 2026
Mbeaulne
commented
Jun 18, 2026
Mbeaulne
commented
Jun 18, 2026
Mbeaulne
commented
Jun 18, 2026
- splitIdentifierText: anchor first capital group to a single char to remove O(n²) regex backtracking on long uppercase runs (behavior-preserving) - stemToken: guard -is/-us endings so status/analysis/axis aren't over-stemmed Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Improves the component search index by normalizing indexed and query text beyond simple lowercasing. Specifically:
snake_case,kebab-case, andcamelCasecomponent names are split into individual words before indexing, so a query like"train model"matches a component namedtrain-modelortrain_model, and"load csv file"matchesloadCSVFile.stemTokenfunction reduces common English inflections (plurals via-s/-ies, gerunds via-ing, past tense via-ed, sibilant plurals) to their base forms. Both the original token and its stem are stored in the index, so queries like"training","datasets", or"batch"match components described with"train","dataset", or"batches".normalizeSearchTextpipeline is applied to query text before scoring, ensuring query tokens and indexed tokens are in the same form.Related Issue and Pull requests
Type of Change
Checklist
Screenshots (if applicable)
Test Instructions
componentSearchIndex.test.ts) to verify the new normalization cases pass:training,datasets,batch) matching indexed descriptions.Additional Comments
The stemmer is intentionally minimal — it handles the most common English suffixes without introducing a full NLP dependency. Both the raw token and its stem are stored so that exact matches are never lost.