How can I boost the score for documents in which my query matches a particular field earlier. For example, searching for "super man" should give "super man returns" a higher score than "there is my super man". Is this possible?
The default boost for a field is 1, so setting a value between 0 and 1 would down boost the document. It is also possible to add different boosts to different fields of a document. The only requirement here is that the boosted fields must store the norms (“omitNorms” attribute in the schema must be set to “false”).
The process of giving higher relevance to a set of documents over others is called boosting, Solr support at least four ways of changing the boost factors of the documents: By boosting terms q=black^2.0 .
Lucene uses the TF/IDF scoring algorithm to give initial relevance scores to each document as served up in a search result. You can set all your QF params to be between [0,2] to get a pseudo normalized curve in the QF part of the score influence.
The bq (Boost Query) Parameter The bq parameter specifies an additional, optional, query clause that will be added to the user's main query to influence the score.
Check for options @ Ranking-based-on-term-position
Solved it myself after reading a LOT about this online. What specifically helped me was a reply on nabble which goes like (I used dismax, so explaining that here):
"_START_ <actual data>"
"_START_ <actual query>"
nameString
as one of the fields to look in in the query fields param (qf)nameString
with a phrase slop of 1 or 2 (lower values would mean stricter searching)Your final query params will be something like:
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 */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With