Question

I have a SOLR query which supports both exact and partial matches. The query terms have appropriate boost factors added where exact matches have higher boost compared to partial matches.

However, within partial matches too, we want to define the boost factors in such a way that

a partial match having a full word gets more priority than a partial match appearing as a part of a word.

For example: If a user searches for a string "Annie Hall", then the documents containing values like: "Tanner Hall", "Hall Pass" etc. should have a higher weight (priority) as compared to values like: "Halloween", " "The Dog Who Saved Halloween". They all are partial matches but "Hall" appears as a separate word in "Tanner Hall" and "Hall Pass" and hence they should have more score.

Please help.

Regards,

No correct solution

OTHER TIPS

I am assuming you are using ngram filter for your queries as it is able to match both the full and the partial matches.

If so, you can always have two fields.

  • Non Ngramed field with higher boost - text
  • NGramed field with normal boost - text_ngram

e.g. For dismax - text^2 text_ngram would result in prefect matches having higher boost then the partial matches.
Remember if there is a full match, there would be a partial match as well so its a cumulative boost.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top