Am using lunr (elastic lunr0.9.5)
as search engine in web browser.
It is simple and very fast as well. but it is not listing exactly matched object in first position when it have more.
My lunr Configuration in Typescript
this.lunrIndex = lunr(function () {
this.field('itemId');
this.field('name');
this.ref('itemId');
this.pipeline.remove(lunr.stemmer)
})
When i search pan d ca
text it is returning,
[{
"ref": "PANCOR DSR CAPSULE 10''S",
"score": 0.01674628244112235
},
{
"ref": "PANLID DSR CAPSULE 10''S",
"score": 0.01674628244112235
},
{
"ref": "PANSIO DSR CAPSULE 10''S",
"score": 0.01590146213665648
},
{
"ref": "PANLIFE DSR CAPSULE 10''S",
"score": 0.015507241586286287
},
{
"ref": "PANSEC DSR CAPSULE 10''S",
"score": 0.014526355502926632
},
{
"ref": "PAN D CAPSULE 10''S",
"score": 0.011554433713104873
}
]
Lunr trimming may be one of reason for above result, so i removed lunr.trimmer
from its pipeline execution and still it giving the same result.
The above result shows, exact matching string(PAN D C
) gets lower score(0.011554433713104873
). am i missed any configuration here ?
I need the exact matching string should get highest score than others, How can i achieve that ?