Repository navigation
fix(weaviate): 保留关键词检索的 BM25 分数 - #6214
Open
Shinku-Chen wants to merge 1 commit into
Open
Shinku-Chen wants to merge 1 commit into
Shinku-Chen wants to merge 1 commit into
Conversation
Preserve finite BM25 scores returned as strings or JSON numbers so keyword sorting and rank fusion can use their original order. Refs: Tencent#6213 Assisted-by: Cindy (https://cindy.app)
This branch has not been deployed
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
Problem
Weaviate's GraphQL keyword search returns
_additional.scoreas a string. The adapter used to leave these hits at zero and assign a constant1.0to scores that arrived as JSON numbers. This discarded the BM25 ordering used by keyword-only searches and by the keyword side of rank fusion.Change
Parse string and numeric scores and pass through the original finite value. Missing, malformed, and non-finite scores keep the zero fallback. Vector certainty still uses the existing cosine conversion. This is a query-time change and works with existing collections.
#5671 is migrating the transport to gRPC. If it lands later, its score handling should also preserve the BM25 value carried by the response.
Impact
Limitations
Type of Change
Related Issue
Fixes #6213.
Testing
0and1and passes with the original values9.205988and2.5. It also covers zero, missing, null, malformed, and non-finite scores.go test -count=1 ./internal/application/repository/retriever/weaviatego test -count=1 ./internal/application/service -run 'TestFuseOrDeduplicate_'golangci-lint run --new-from-rev=upstream/main ./internal/application/repository/retriever/weaviate(v2.12.2, 0 issues)Validation was scoped to the adapter and fusion tests.
ac4d9dc2: the Tencent open-source scan passed; App and Go Lint areaction_required(awaiting approval for the fork PR).Checklist
git diff --check upstream/main...HEADpasseswebsite-docs/, Swagger annotations, etc.)Screenshots / Recordings
N/A. Backend scoring only.
Assisted-by: Cindy (https://cindy.app)