Database / Milvus Vector database Interview questions
What is hybrid search in Milvus?
Hybrid search combines results from more than one search signal, most commonly a dense semantic vector (capturing overall meaning) and a sparse vector or keyword-style signal (capturing exact term matches), into a single ranked result set, rather than relying on just one retrieval method alone.
from pymilvus import AnnSearchRequest, WeightedRanker dense_request = AnnSearchRequest( data=[dense_query_vector], anns_field="dense_embedding", limit=20 ) sparse_request = AnnSearchRequest( data=[sparse_query_vector], anns_field="sparse_embedding", limit=20 ) results = client.hybrid_search( collection_name="documents", reqs=[dense_request, sparse_request], ranker=WeightedRanker(0.7, 0.3), limit=10 )
This matters because dense semantic search and sparse keyword-style search have complementary strengths and weaknesses: dense vectors are good at capturing paraphrased meaning but can miss an exact rare term or product code, while sparse/keyword matching nails exact terms but misses semantically related phrasing. Combining both, using a reranking strategy like weighted scoring or Reciprocal Rank Fusion, typically produces more relevant results than either approach alone.
More Related questions...