fix(import-markdown): dedup uses retrieve() hybrid search (fixes rank-1 gap)#720
Closed
jlin53882 wants to merge 1 commit intoCortexReach:masterfrom
Closed
fix(import-markdown): dedup uses retrieve() hybrid search (fixes rank-1 gap)#720jlin53882 wants to merge 1 commit intoCortexReach:masterfrom
jlin53882 wants to merge 1 commit intoCortexReach:masterfrom
Conversation
…bm25Search rank-1 only Replaces ctx.store.bm25Search(text, 5) with ctx.retriever.retrieve() for the dedup check in import-markdown. The old approach only checked the top BM25 result, missing duplicates when the true match was ranked 2-5. The new approach runs the full hybrid pipeline (BM25 + vector + rerank) against 20 candidates, then exact-matches the top result — the same pipeline used for normal retrieval, ensuring consistent dedup coverage. Fixes: deduplication gap in import-markdown where identical texts in scope were not detected when the BM25 rank of the true duplicate was > 1. Refs: Issue CortexReach#715
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Apr 30, 2026
Contributor
Author
This was referenced May 1, 2026
Closed
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.
Problem
The dedup check in
import-markdownusedctx.store.bm25Search(text, 5)and only compared against the top result (existing[0]). When an identical text existed in the same scope but was ranked 2–5 by BM25, it was not detected — causing duplicate imports.Fix
Replace
bm25Searchwithctx.retriever.retrieve()withlimit: 20, then exact-matchresults[0].entry.text. This runs the full hybrid pipeline (BM25 + vector + reranker) against 20 candidates before exact-matching the top result — the same pipeline used for normal retrieval.Before (Bug):
After (Fix):
Scope
cli.tsRefs