fix: Uploaded document is not retrievable/searchable using its unique content.#1271
Merged
Conversation
added 2 commits
March 26, 2026 10:20
Improve hybrid search quality with a default score threshold, short-query threshold relaxation, prefix matching support, and exact-file preference for unique query text. Made-with: Cursor
Use safer prefix fallback behavior for current index mappings and keep aggregations aligned with post-filtered exact file results. Made-with: Cursor
lucaseduoli
approved these changes
Mar 26, 2026
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.
issue: #1138
Improved Knowledge search relevance and partial-query handling by tuning frontend threshold defaults and backend hybrid query behavior.
Before:
Default scoreThreshold was effectively 0 when not provided, so low-relevance files were often included.
Short partial queries (like vita) often returned nothing.
Unique terms could still return unrelated files due to semantic spillover.
Returned total could reflect raw backend hits instead of post-filtered displayed results.
https://github.com/user-attachments/assets/47b4ff45-62a4-473d-b440-e1b82720be9e
Now:
Default scoreThreshold is 1.25 (frontend), with dynamic relaxation to 1.0 for short single-token queries (<=4 chars).
Backend keyword branch is stricter (operator: and, fuzziness: AUTO:4,7) and includes bool_prefix support for partials.
Added exact-text file preference: if query appears verbatim in specific files, results are narrowed to those files.
Fixed exact-file filtering robustness (only valid string filenames considered).
total now matches the actual filtered results shown (len(chunks)).
https://github.com/user-attachments/assets/7d073caf-c00d-41ee-aaa7-6a3735d86a91
merged in release-0.4.0, cheery-pick from: #1183