Skip to content

Commit

Permalink
enhance: [cherry-pick] Update sparse+dense hybrid search example (#2014)
Browse files Browse the repository at this point in the history
use IP as the BGE-M3 dense embeddings relevance example

Signed-off-by: Buqian Zheng <[email protected]>
  • Loading branch information
zhengbuqian authored Apr 9, 2024
1 parent ed6415f commit df9d2e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/hello_hybrid_sparse_dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def random_embedding(texts):
# into memory for efficient search.
sparse_index = {"index_type": "SPARSE_INVERTED_INDEX", "metric_type": "IP"}
col.create_index("sparse_vector", sparse_index)
dense_index = {"index_type": "FLAT", "metric_type": "L2"}
dense_index = {"index_type": "FLAT", "metric_type": "IP"}
col.create_index("dense_vector", dense_index)
col.load()

Expand All @@ -93,7 +93,7 @@ def random_embedding(texts):
sparse_search_params = {"metric_type": "IP"}
sparse_req = AnnSearchRequest(query_embeddings["sparse"],
"sparse_vector", sparse_search_params, limit=k)
dense_search_params = {"metric_type": "L2"}
dense_search_params = {"metric_type": "IP"}
dense_req = AnnSearchRequest(query_embeddings["dense"],
"dense_vector", dense_search_params, limit=k)

Expand Down

0 comments on commit df9d2e6

Please sign in to comment.