elasticlunr.js icon indicating copy to clipboard operation
elasticlunr.js copied to clipboard

Boost complete matches more than partial matches

Open lnikell opened this issue 7 years ago • 2 comments

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?

lnikell avatar Apr 25 '17 07:04 lnikell

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

twobob avatar May 01 '17 17:05 twobob

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.

gavJackson avatar Dec 14 '18 15:12 gavJackson