fix(search): infer support query domain from SUPPORT_TAGS#59
Merged
Merged
Conversation
inferQueryDomain only scored TECHNICAL_TAGS and OPS_TAGS, so any query
made of support tokens (faq/onboarding/guide/user/…) was classified as
'neutral'. Under DOMAIN_WEIGHT.neutral, support entries get a 0.3 weight
while neutral entries get 0.85 — so a genuine support question ranked a
matching support doc *below* an unrelated neutral doc, the opposite of
the intended ranking.
This is also asymmetric with inferDomain (which scores all three tag
sets) and contradicts inferQueryDomain's own doc comment ("uses the same
tag sets … so the two sides of the matching are symmetric").
Score SUPPORT_TAGS too, with the same technical > ops > support
tie-breaking as inferDomain. Added a regression test that builds a real
index and asserts a support-domain query ranks the support entry above
an equal-raw-score neutral entry (fails before the fix: 2.4 vs 6.8).
Co-Authored-By: Claude <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.
Summary
inferQueryDomain(insrc/utils/search-index.ts) only scoresTECHNICAL_TAGSandOPS_TAGS— it never looks atSUPPORT_TAGS. As a result any query made of support tokens (faq,onboarding,guide,user, …) is classified asneutral.This is both a ranking bug and an internal inconsistency:
DOMAIN_WEIGHT.neutral, support entries get weight 0.3 while neutral entries get 0.85. So a genuine support question ranks a matching support document below an unrelated neutral document — the opposite of the intended ranking.inferDomain(lines ~167–183), which scores all three tag sets, and contradictsinferQueryDomain's own doc comment: "Uses the same tag sets used for document domain inference so the two sides of the matching are symmetric."Fix
Score
SUPPORT_TAGSas well, mirroringinferDomain:Test
Added a regression test (
search-domain-weighting.test.ts) that builds a real index with two identical-score entries — onedomain: support, onedomain: neutral— and queries with support tokens. It asserts the support entry outranks the neutral one.2.4, neutral6.8(support penalized ×0.3 under the mis-inferredneutralquery domain).support, support entry outranks neutral.npm test→ 1440 passed;tsc --noEmit→ clean.