1

I am trying to set up elevate handler in SOLR 3.5.0 and I need the equivalent of the below query in dismax format which defines different boost values on the same field based on the match type(exact match gets 200 whereas wildcard match gets 100).

q=name:(foo*^100.0 OR foo^200.0)

1 Answers1

0

This is one way to solve this problem.

Keep a text field with only WhiteSpaceTokenizer (and maybe LowerCaseFilter depending on your case-sensitivity needs). Use this field for the exact match. Let's call this field name_ws.

Instead of using a wild-card query on name_ws, use a text-type copy field with EdgeNGramTokenizer in your analyzer chain, which will output tokens like:

food -> f, fo, foo, food

Let's call this field name_edge.

Then you can issue this dismax query:

q=foo&defType=dismax&qf=name_ws^200+name_edge^100

(Add debugQuery=on to verify if the scoring works the way you want.)

arun
  • 10,685
  • 6
  • 59
  • 81