Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' of https://github.com/docarray/docarray into fix-…
…num-docs

Signed-off-by: Joan Fontanals Martinez <[email protected]>
  • Loading branch information
Joan Fontanals Martinez committed Jul 26, 2023
commit dbdc99003b98fb8f1635e9fdec8ad69a1391e2ba
7 changes: 5 additions & 2 deletions docarray/index/backends/hnswlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,11 @@ def accept_hashed_ids(id):

# If hashed_ids is provided, k is the minimum of limit and the length of hashed_ids; else it is limit
k = min(limit, len(hashed_ids)) if hashed_ids else limit

labels, distances = index.knn_query(queries, k=k, **extra_kwargs)
try:
labels, distances = index.knn_query(queries, k=k, **extra_kwargs)
except RuntimeError:
k = min(k, self.num_docs())
labels, distances = index.knn_query(queries, k=k, **extra_kwargs)

result_das = [
self._get_docs_sqlite_hashed_id(
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.