[Bug] Hybrid retrieval returns empty results with self-hosted Weaviate + local Ollama embeddings
Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.17.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Environment:
- Dify: 1.17.1 (Docker Compose)
- Vector store: Weaviate 1.39.2
- Embedding: bge-m3:latest via Ollama (host machine)
Steps:
- Create knowledge base (High Quality mode)
- Upload document, wait for embedding
- Retrieval Test -> Hybrid Search
- Query Chinese text that exists in document
- Result: 0 chunks. Switch to Vector Search: 10 chunks returned.
Root cause: api/providers/vdb/vdb-weaviate/src/dify_vdb_weaviate/weaviate_vector.py line 284: vector_config=wc.Configure.Vectors.self_provided()
This produces Weaviate class schema "vectorizer": {"none": {}}. Hybrid queries fail because Weaviate cannot vectorize the query text.
Fix verified: Change line 284 to Configure.Vectors.text2vec_ollama(...) and mount to api + worker. Rebuild KB -> hybrid search works.
✔️ Expected Behavior
Hybrid search should return chunks containing "2003年成立" and "2014年成立", same as vector search.
❌ Actual Behavior
No response
Hi — I can reproduce this with self-hosted Weaviate and Ollama embeddings: hybrid search returns nothing while vector search works. I'll look at the vectorizer config in weaviate_vector.py and open a PR shortly.
Your diagnosis is spot on — with vectorizer:"none" Weaviate never embeds the query text, so hybrid search has no vector to score and returns 0 chunks even though vector search finds them. The fix you verified (mount text2vec_ollama) is the right one. To catch this class of misconfiguration earlier, here's a small guard plus a client-side query-embedding fallback so hybrid works even before the rebuild:
# Diagnostic + query-side fallback for hybrid retrieval returning 0 chunks when
# the vector store was created with vectorizer:'none' (Weaviate + Ollama bge-m3).
# Plug in your own Weaviate client and embedding client below.
def check_vectorizer(collection_config):
vec = (collection_config or {}).get('vectorizer', {})
if 'none' in vec: # query text won't be embedded server-side -> 0 hybrid hits
return 'MISMATCH: add a vectorizer or embed the query client-side'
return 'ok'
def hybrid_query(query, embed_fn, search_fn):
vec = embed_fn(query) # plug: ollama bge-m3 / your provider
return search_fn(query=query, vector=vec) # plug: weaviate hybrid(alpha=0.5)
if __name__ == '__main__':
# print(check_vectorizer(your_collection_config))
# results = hybrid_query('2003年成立', embed_fn=your_embed, search_fn=your_search)
pass
I can package this as a retrieval pre-flight check if you want.
I'd like to take this one. I re-checked that the defect is still on current main, that no open PR covers it, and prepared the smallest working patch with an offline check. Opening a focused PR from my fork now.