Solr - How to increase points for early matches?

How can I increase scores for documents in which my request matches a specific field earlier. For example, a search for “Superman” should give “Superman Returns” a higher score than “have my Superman”. Is it possible?

+5
source share
2 answers

I decided it myself after reading LOT about it on the Internet. What specifically helped me was the response to picky, which sounds like this: (I used smax, so explaining it here):

  • Create a separate field named say 'nameString' that stores the value as "_START_ <actual data>"
  • Change your search query to "_START_ <actual query>"
  • Add a new field nameStringas one of the search fields to param (qf) request fields
  • pf ( ) nameString slop 1 2 ( )

:

q=_START_ <actual query>
defType=dismax
qf=name nameString /* look in name field as well as nameString field */
pf=nameString /* phrase field in nameString */
ps=2 /* phrase slop */
+1

All Articles