Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Do not bypass threshold for rerank when metadata filter is enabled (#14684)

qinling02104d6e8dffacb0
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)