When trying to bring in Fuse.createIndex() it gives me this error:
TypeError: path.indexOf is not a function. (In 'path.indexOf('.')', 'path.indexOf' is undefined)
6.0.4
Don't know.
function buildIndex( items, options ) {
const defaults = {
isCaseSensitive: false,
shouldSort: true,
minMatchCharLength: 2
};
const mergedOptions = {...defaults , ...options};
return Fuse.createIndex( mergedOptions.keys, items );
}
const datasets = [
{title: "Foo", description: "Superfooicious"},
{title: "Bar", description: "Superbaricious"}
];
const options = {
keys: [
{name: 'title', weight: 2},
{name: 'description', weight: 1}
]
};
const searchIndex = buildIndex( datasets, options );
Nothing to say. But yeah I love Fuse.js!!!
That's fair a flag. I designed this on purpose, since generating the index is completely different, and does not require weights (since weighting is applied at query time).
Nonetheless, it feels like I could just support this functionality, so people don't have to deal with different arg formats.
I will do this for the next release. Thanks!
Now in latest [email protected]
since weighting is applied at query time
So passing options (including keys) again as the second parameter to Fuse() does not cause it to rebuild it's index but really uses the one I pass as third parameter?