elasticlunr.js
elasticlunr.js copied to clipboard
Boost complete matches more than partial matches
Is it possible to make with elaticlunr configuration which will support boost complete matches more than partial matches.
Example:
Search query: "Flight Change" Current results:
- "Flight disruption - Involuntary Rebooking - Schedule Change"
- "Voluntary Rebooking - Change Flight Date"
- "Voluntary Rebooking - Urgent Rebooking / Urgent Flight Change"
But I want to have results in order like this:
- "Voluntary Rebooking - Urgent Rebooking / Urgent Flight Change"
- "Voluntary Rebooking - Change Flight Date"
- "Flight disruption - Involuntary Rebooking - Schedule Change"
Is it possible to do with elasticlunr?
The documentation on weighting is pretty comprehensive and I believe it covers this use case. https://www.elastic.co/guide/en/elasticsearch/guide/current/practical-scoring-function.html perhaps https://www.elastic.co/guide/en/elasticsearch/guide/current/ignoring-tfidf.html or ultimately https://www.elastic.co/guide/en/elasticsearch/guide/current/function-score-query.html can meet your needs. FWIW I kind of recall hacking Lunr (the pre-fork original) to do similar without all that fancy toolage so I'm going with "Yes" since all these bells and whistles are freely attached to elasticlunr
I would also like to boot complete matches, @lnikell don't suppose you ever figured it out? Your question is exactly the same as my issue.