nextapps-de / flexsearch

Next-Generation full text search library for Browser and Node.js
Apache License 2.0
12.53k stars 491 forks source link

[Bug] Exported Keys of a DocumentIndex have improper format #260

Closed samuelnunoo closed 2 years ago

samuelnunoo commented 3 years ago

Issue

Exported Keys of a DocumentIndex have improper format. This can be reproduced by create a nested document index, exporting the keys. When you try to reimport the keys you'll see that they'll have the format "field1-field2..." instead of "field1:field2" which leads to an undefined error.

After messing around with different key formats I found that this works


//Note result is the exported index data
    const newIndex = new Document(config)

    for (const r in result) {

        let string = r.replace("-",":")
        console.log(string)
        newIndex.import(string,result[r]) //

    }

    newIndex.search("Whales") 
ts-thomas commented 2 years ago

This is now fixed in v0.7.23 Further improvements to provide Promise.all() compatible export ist coming in next version.