Default relevance weighting for FTS search (title vs. body) #1819
marcusbellamyshaw-cell
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
FTSManager.enableSearch()callsbm25()with noweightsargument unless thecaller explicitly passes one, so every searchable field counts equally toward
ranking. A result whose title matches the query ranks the same as a result that
merely mentions the query term once, incidentally, somewhere in a long body — both
are "correct" matches, but users expect the title-relevant one to rank higher.
weightsis already supported end-to-end (setSearchConfig,POST /_emdash/api/search/enable) — sites can fix this today by passing explicitper-field weights. The ask here is a better default, since most sites won't
discover or configure
weightson their own.Suggestion
Default to weighting the
titlefield higher than other searchable fields when noexplicit
weightsare supplied — e.g. title: 3, everything else: 1 — rather thanthe current implicit all-1 default. Open to whatever ratio the maintainers think is
right; flagging the problem and a starting number, not insisting on this exact one.
Alternatives considered
weights. Doesn't helpsites that never read that doc section.
weightsexplicitly (no default) — breaking change, not worth it for aranking quality-of-life improvement.
All reactions