Fix score_threshold applied backwards for Recommend/Discover/Context on Euclidean/Manhattan collections - #1374
Conversation
…on Euclidean/Manhattan collections In local/in-memory mode, LocalCollection.search() has an isinstance override that correctly treats Recommend (best_score/sum_scores), Discover, and Context queries as bigger-is-better (since they use sigmoid-based synthetic scores), regardless of the collection's underlying distance metric. This override was applied to the sort direction but not repeated for the score_threshold comparison a few lines below, which branched on required_order alone. On a Euclidean or Manhattan collection this caused the threshold check to use the comparison direction meant for raw distances, breaking the loop on the very first (best-scoring) point and returning zero results for any non-extreme threshold. Extracted the override into a single bigger_is_better variable used consistently by both the sort and the threshold check. Fixes qdrant#1370.
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized fix corrects score-threshold handling for affected query types; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes #1370. The isinstance override that marks Recommend (best_score/sum_scores), Discover, and Context queries as bigger-is-better was applied to sort direction but not to the score_threshold comparison, causing local-mode queries on Euclidean/Manhattan collections to return zero results for any reasonable threshold. Extracted the check into a single bigger_is_better variable used by both.