Hybrid search hybrid_top_k does not work for Postgres #19606
Replies: 1 comment 2 replies
-
Hi @vijayant-panda! I'm Dosu and I’m helping the llama_index team. You're correct—PGVectorStore's hybrid search in LlamaIndex does not support a unified hybrid_top_k. Instead, it runs dense and sparse queries separately, applies their own top_k, and merges the results. There’s no fusion results method like in MongoDB; this means you can’t pass a single top_k for the entire hybrid search, and the merged results may not reflect a true top-k across both modalities example & docs. If you want a more meaningful hybrid top_k, you can use the QueryFusionRetriever, which fuses and re-ranks results from both vector and text retrievers. This approach lets you specify a single similarity_top_k for the fused results and achieves the behavior you’re looking for see usage. Let me know if you want a code snippet for QueryFusionRetriever setup! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In the PG Vector store, whenever hybrid search is used, in the _async_hybrid_query , the dense and the sparse results are being merged . Individually sparse top k and similarity top k is being applied ..
hybrid top k is not being used in this implementation.. Any idea if we can somehow pass just one top_k for the entire hybrid search..
I think fusion results method is not implemented in PG Vector store unlike mongodb etc.
Beta Was this translation helpful? Give feedback.
All reactions