From 4d6e8dffacb05e1f43801e4c8cdd3e1c763beb12 Mon Sep 17 00:00:00 2001 From: qinling0210 <88864212+qinling0210@users.noreply.github.com> Date: Fri, 8 May 2026 17:48:30 +0800 Subject: [PATCH] Do not bypass threshold for rerank when metadata filter is enabled (#14684) ### What problem does this PR solve? Do not bypass threshold for rerank when metadata filter is enabled ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/nlp/search.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rag/nlp/search.py b/rag/nlp/search.py index 8563e9bd58..57b663400e 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -536,11 +536,6 @@ class Dealer: # When vector_similarity_weight is 0, similarity_threshold is not meaningful for term-only scores. post_threshold = 0.0 if vector_similarity_weight <= 0 else similarity_threshold - # When doc_ids is explicitly provided (metadata or document filtering), bypass threshold - # User wants those specific documents regardless of their relevance score - if doc_ids: - post_threshold = 0.0 - valid_idx = [int(i) for i in sorted_idx if sim_np[i] >= post_threshold] filtered_count = len(valid_idx) ranks["total"] = int(filtered_count)