{{ message }}
Repository navigation
fix(groupBy): correct minDistance and maxDistance in multi-shard merge and hybrid search (#13108) - #13131
Open
ManoharPaturi wants to merge 1 commit into
Open
fix(groupBy): correct minDistance and maxDistance in multi-shard merge and hybrid search (#13108)#13131ManoharPaturi wants to merge 1 commit into
ManoharPaturi wants to merge 1 commit into
Conversation
…e and hybrid search (weaviate#13108) Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
Author
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.




Fixes #13108
Problem
In
groupByqueries,minDistanceandmaxDistancedescribe the minimum and maximum distances of the group's hits. Two execution paths compute or assign them incorrectly:adapters/repos/db/group_merger.go):After hits from all shards are merged and sorted ascending by distance (
hits[i].Distance < hits[j].Distance),MaxDistancewas assignedhits[0](the lowest distance) andMinDistancewas assignedhits[len(hits)-1](the highest distance). For multi-shard queries, this invertedminDistanceandmaxDistance(minDistance > maxDistance).usecases/traverser/hybrid_group_by.go):In
groupSearchResults, bothMinDistanceandMaxDistancewere assignedfirst.Dist, copying only the first hit's distance and ignoring all other members of the group. Since hybrid search ranks hits by fusion score (not pure distance),first.Distdoes not represent the minimum or maximum distance of the group.Solution
adapters/repos/db/group_merger.go: AssignMinDistancefromhits[0](smallest distance) andMaxDistancefromhits[len(hits)-1](largest distance).usecases/traverser/hybrid_group_by.go: Iterate over all retainedgroupMembersto compute the minimum and maximum hit distances for the group.adapters/repos/db/group_merger_test.goandusecases/traverser/hybrid_group_by_test.gocovering multi-shard merges,ObjectsPerGroupcapping, group ordering, and hybrid search distance tracking.Verification
go test -v -run TestGroupMerger ./adapters/repos/dbpasses.go test -v -run TestExplorerGroupSearchResults ./usecases/traverserpasses.