Skip to content

fix: save index during creation for hnswlib#1424

Merged
AnneYang720 merged 2 commits intomainfrom
fix-hnswlib-index
Apr 19, 2023
Merged

fix: save index during creation for hnswlib#1424
AnneYang720 merged 2 commits intomainfrom
fix-hnswlib-index

Conversation

@AnneYang720
Copy link
Copy Markdown
Contributor

This PR is related to issue #1351

The issue is that using two time the same work_dir lead to error.

from docarray.documents import ImageDoc
from docarray.index import HnswDocumentIndex

# create a Document Index
index = HnswDocumentIndex[ImageDoc](work_dir='/tmp/test_index2')
index = HnswDocumentIndex[ImageDoc](work_dir='/tmp/test_index2') # second time is failing

The error is that hnswlib index file .bin is created in function index() but not _create_index(). Second time it tries to load .bin file from the work_dir, which doesn't exist.

@github-actions
Copy link
Copy Markdown

📝 Docs are deployed on https://ft-fix-hnswlib-index--jina-docs.netlify.app 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants