Browse Source

Revert bypass hybrid search when BM25_weight=0

Revert PR https://github.com/open-webui/open-webui/commit/74b1c801
_00_ 1 month ago
parent
commit
647e38f701
1 changed files with 2 additions and 7 deletions
  1. 2 7
      backend/open_webui/retrieval/utils.py

+ 2 - 7
backend/open_webui/retrieval/utils.py

@@ -128,8 +128,6 @@ def query_doc_with_hybrid_search(
             log.warning(f"query_doc_with_hybrid_search:no_docs {collection_name}")
             return {"documents": [], "metadatas": [], "distances": []}
 
-        # BM_25 required only if weight is greater than 0
-        if hybrid_bm25_weight > 0:
             log.debug(f"query_doc_with_hybrid_search:doc {collection_name}")
             bm25_retriever = BM25Retriever.from_texts(
                 texts=collection_result.documents[0],
@@ -343,8 +341,7 @@ def query_collection_with_hybrid_search(
     # Fetch collection data once per collection sequentially
     # Avoid fetching the same data multiple times later
     collection_results = {}
-    # Only retrieve entire collection if bm_25 calculation is required
-    if hybrid_bm25_weight > 0:
+
         for collection_name in collection_names:
             try:
                 log.debug(
@@ -356,9 +353,7 @@ def query_collection_with_hybrid_search(
             except Exception as e:
                 log.exception(f"Failed to fetch collection {collection_name}: {e}")
                 collection_results[collection_name] = None
-    else:
-        for collection_name in collection_names:
-            collection_results[collection_name] = []
+                
     log.info(
         f"Starting hybrid search for {len(queries)} queries in {len(collection_names)} collections..."
     )