Skip to content

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

Fix: No results can be found through the API /api/v1/dify/retrieval (#11338)

Yongteng Lei341e5904c847
diff --git a/api/apps/sdk/dify_retrieval.py b/api/apps/sdk/dify_retrieval.py
index d2c3485a94..e02875820e 100644
--- a/api/apps/sdk/dify_retrieval.py
+++ b/api/apps/sdk/dify_retrieval.py
@@ -131,12 +131,10 @@ def retrieval(tenant_id):
return build_error_result(message="Knowledgebase not found!", code=RetCode.NOT_FOUND)
embd_mdl = LLMBundle(kb.tenant_id, LLMType.EMBEDDING.value, llm_name=kb.embd_id)
- print(metadata_condition)
- # print("after", convert_conditions(metadata_condition))
- doc_ids.extend(meta_filter(metas, convert_conditions(metadata_condition)))
- # print("doc_ids", doc_ids)
- if not doc_ids and metadata_condition is not None:
- doc_ids = ['-999']
+ if metadata_condition:
+ doc_ids.extend(meta_filter(metas, convert_conditions(metadata_condition)))
+ if not doc_ids and metadata_condition:
+ doc_ids = ["-999"]
ranks = settings.retriever.retrieval(
question,
embd_mdl,