Running index.insertItem in parallel results in a corrupted database #33
Answered
by
Stevenic
poetsmeniet
asked this question in
Q&A
-
To speed up the process of embedding a large-ish document, I run into issues with a corrupted database. The error is "Unexpected number in JSON at position x" The json file (vector database) is clearly corrupted. Is it even possible to run index.insertItem in parallel? |
Beta Was this translation helpful? Give feedback.
Answered by
Stevenic
Dec 1, 2023
Replies: 1 comment
-
Yes... You need to call index.beginUpdate();
try {
// Do your updates
// Commit changes to disk
index.endUpdate();
} catch (err) {
// Abort changes
index.cancelUpdate();
throw err;
} That will generally speed up mass updates anyway. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Stevenic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes... You need to call
index.beginUpdate()
first followed byindex.endUpdate()
to commit your changes to disk. Here's some code:That will generally speed up mass updates anyway.