Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

fix: save index during creation for hnswlib - #1424

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

AnneYang720 merged 2 commits into
mainfrom
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.

Signed-off-by: AnneY <evangeline-lun@foxmail.com>
Signed-off-by: AnneY <evangeline-lun@foxmail.com>
@github-actions

Copy link
Copy Markdown

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants