No Results When Using Weight Settings in Hybrid Search with Knowledge Retriever #9247

Closed
opened 2026-02-21 18:32:21 -05:00 by yindo · 0 comments
Owner

Originally created by @unmo on GitHub (Mar 5, 2025).

Originally assigned to: @JohnJyong on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When configuring hybrid search with weight settings in the Knowledge Retriever (Dify v0.15.2), no results are returned.

As shown in the attached image, when the search settings are configured as follows, no text chunks are retrieved:

Vector Search: 0.7
Keyword Search: 0.3
topK: 10
No Score Threshold
image

Search Results:
image

However, when using the reranker setting, documents are retrieved correctly. Therefore, it is unlikely that there are no relevant documents.

Why does this happen? It seems to occur only when using Hybrid Search with weight settings.

After checking the API container logs, the following error was found, which might be related to the issue:

File "/usr/local/lib/python3.12/threading.py", line 1012, in run self._target(*self._args, **self._kwargs) File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 518, in _retriever documents = RetrievalService.retrieve( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/datasource/retrieval_service.py", line 116, in retrieve all_documents = data_post_processor.invoke( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/rerank/weight_rerank.py", line 49, in run query_vector_scores = self._calculate_cosine(self.tenant_id, query, documents, self.weights.vector_setting) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/rerank/weight_rerank.py", line 175, in _calculate_cosine dot_product = np.dot(vec1, vec2) ^^^^^^^^^^^^^^^^^^ ValueError: shapes (768,) and (384,) not aligned: 768 (dim 0) != 384 (dim 0)

Document embedding and query embeddng are using same Embedding model.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @unmo on GitHub (Mar 5, 2025). Originally assigned to: @JohnJyong on GitHub. ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When configuring hybrid search with weight settings in the Knowledge Retriever (Dify v0.15.2), no results are returned. As shown in the attached image, when the search settings are configured as follows, no text chunks are retrieved: Vector Search: 0.7 Keyword Search: 0.3 topK: 10 No Score Threshold ![image](https://github.com/user-attachments/assets/c3ed8bb5-edc3-4828-a23f-1b6dd3e60393) Search Results: ![image](https://github.com/user-attachments/assets/d2b9b4fa-e9e2-4840-8c66-1f92990c9ebe) However, when using the reranker setting, documents are retrieved correctly. Therefore, it is unlikely that there are no relevant documents. Why does this happen? It seems to occur only when using Hybrid Search with weight settings. After checking the API container logs, the following error was found, which might be related to the issue: `File "/usr/local/lib/python3.12/threading.py", line 1012, in run self._target(*self._args, **self._kwargs) File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 518, in _retriever documents = RetrievalService.retrieve( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/datasource/retrieval_service.py", line 116, in retrieve all_documents = data_post_processor.invoke( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/rerank/weight_rerank.py", line 49, in run query_vector_scores = self._calculate_cosine(self.tenant_id, query, documents, self.weights.vector_setting) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/rerank/weight_rerank.py", line 175, in _calculate_cosine dot_product = np.dot(vec1, vec2) ^^^^^^^^^^^^^^^^^^ ValueError: shapes (768,) and (384,) not aligned: 768 (dim 0) != 384 (dim 0) ` Document embedding and query embeddng are using same Embedding model. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:32:21 -05:00
yindo closed this issue 2026-02-21 18:32:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#9247