Closed alejoar closed 8 months ago
Looks like tags also get lost after import
I’m running into the same issue and can confirm it
The only solution I found was to store the original data set and restore using index.add
There is a bug in the way exportDocument
works: while store
and tag
are both global and point to individual documents, they are being exported within the scope of the field
(aka individual index). Then, when re-imported, they are not handled a global in importDocument
and are passed to importIndex
method where they are discarded.
I've created a PR that addresses this issue.
I'm running into the same issue when normally adding Document records:
const transcriptsJson = (await JSON.parse(file)) as Array<{
id: number;
url: string;
transcript: Array<{
timestamp: string;
transcript: string;
}>;
}>;
const flexIndex = new Document({
tokenize: "full",
document: {
id: "record:id",
index: ["record:url", "record:transcript[]:transcript"],
},
});
transcriptsJson.forEach((_video) => {
flexIndex.add({
record: {
id: _video.id,
url: _video.url,
transcript: [..._video.transcript],
},
});
});
const x = flexIndex.search("youtube", {
limit: 5,
suggest: true,
index: ["record:url", "record:transcript[]:transcript"],
enrich: true,
});
console.log(x);
which returns
Unable to import content.store
.
Please fix this... The library isn't useful when one cannot retrieve previously stored data...
Demo:
Create and export an index:
Now import it:
Run everything:
Output: