Skip to content

Precomputed index returns no results #624

@GonzaloZiadi

Description

@GonzaloZiadi

Same as #524. Copying over from there with slight tweaks.

Describe the bug

Empty results when loading precomputed index.

Version

6.5.3

Is this a regression?

don't know

🔬Minimal Reproduction

const Fuse = require('fuse.js');
const fs = require('fs');

const datasets = [{"title":2},{"title":3}];
const options = {
  keys: ['title']
};
var myIndex = Fuse.createIndex(options.keys, datasets);

fs.writeFileSync('./index.json', JSON.stringify(myIndex.toJSON()));

const fuse = new Fuse(datasets, options, myIndex);

var search_term = process.argv[2];
var result = fuse.search(search_term);
console.log(result);
console.log(myIndex);

Additional context

The last print shows that docs, keys, records is empty, if loaded from the precomputed index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions