Normalize component search tokens for better matching#2424
Conversation
🎩 PreviewA preview build has been created at: |
🤖 Code review — Normalize component search tokens for better matchingSolid normalization layer: Two things worth weighing:
Nit: the hand-rolled stemmer is intentionally approximate and produces some odd stems ( |
0494d71 to
5204de5
Compare
8fa4ce4 to
cf53326
Compare
5204de5 to
a17926c
Compare
- 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>
cf53326 to
f61b2d4
Compare
a17926c to
0b471b1
Compare

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.