Skip to content

Commit

Permalink
Fix a bug in concurrent searching
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-maan committed Jan 17, 2025
1 parent c4ab1a1 commit 3c97cdb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions services/vector_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
cache = {}

def load_indexes():
for index_id in indexdir.available():
index_ids = sorted(indexdir.available())
for index_id in index_ids:
index = indexdir.get(index_id)[0]
cache[index_id] = index

Expand All @@ -47,7 +48,7 @@ async def health():
def search_index(t):
idx, qvec, n = t
results = cache[idx].search(qvec, n)
results = [(doc_id, idx, score) for doc_id, score in results]
results = [(doc_id, idx, 1.0-dist) for doc_id, dist in results]
return results

def concurrent_search(idxs, qvec, n):
Expand Down

0 comments on commit 3c97cdb

Please sign in to comment.