fix(search): correct vchord BM25 score direction#1453
Merged
nicoloboschi merged 1 commit intovectorize-io:mainfrom May 5, 2026
Merged
fix(search): correct vchord BM25 score direction#1453nicoloboschi merged 1 commit intovectorize-io:mainfrom
nicoloboschi merged 1 commit intovectorize-io:mainfrom
Conversation
The `<&>` operator returns a distance metric where lower values mean higher relevance, but the code was using DESC ordering, causing the least relevant results to appear first. Negate the distance to get a proper score (higher = more relevant), matching pg_textsearch behavior.
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
<&>BM25 distance operator so that higher scores mean higher relevance, matching pg_textsearch behaviorThe
<&>operator returns a distance metric (lower = more relevant), but the code usedDESCordering, causing the least relevant results to appear first.Test plan
HINDSIGHT_API_TEXT_SEARCH_EXTENSION=vchordpg_textsearchand verify ordering remains correct