flexsearch
flexsearch copied to clipboard
am i not smart enough? how can i get a scored result for mutliple fields
hi, when using documents with multiple fields, then my goal is to have a final result with a scoring based on the searchresult.
at the moment i would get just an array per field and no scoring information.
for example:
let index = new Document({
document: {
id: 'gid',
index: [
'givenNameReal',
'surnameReal',
'mainTasks'
]
}
});
let people = [{gid:1,givenNameReal:'Michael',surnameReal:'Mustermann',mainTasks:'something'},{gid:2,givenNameReal:'Hans',surnameReal:'Franz',mainTasks:'mustering else'}];
people.forEach((person: any) => {
index.add(
person);
});
let result = this.index.search('Mich Muster');
so the result should be something like this:
[{gid:1,score:'0.8',findings:[{field:'givenNameReal',term:'Mich'},{field:'surnameReal',term:'Muster'}]}, {gid:2,score:'0.01',findings:[{field:'mainTasks',term:'Muster'}]}]
I'm looking forward to the same thing, like Fuse.js https://fusejs.io/api/options.html#includescore
Sorry no score documented, no score available, the score value is just calculated in the background and is applied to the order of results.