I am using Solr version 7.3.0. The documents in it having fields like title, description, content , date. The search criteria would be like, first priority is for title field then description field and at the last content field. After that I am applying sorting on the date field. So the results get mixed. I want the result would appear like first according to title field arranged by date, then description arranged by date and then content arranged by date. Not able to find how to achieve this?
1 Answers
0
votes
The qf
parameter introduces a list of fields, each of which is assigned a boost factor to increase or decrease that particular field’s importance in the query. For example, the query below:
qf="fieldOne^2.3 fieldTwo fieldThree^0.4"
In your case it would be
qf="title^10 description^7 content^5"
qf="title^10 description^5 content"
assigns title
a boost of 10, description
with the boost of 7 and content
a boost of 5 or can be left as blank which it will consider as default one. These boost factors make matches in title
much more significant than matches in description, which in turn are much more significant than matches in content.
Your solr request will look like below
http://localhost:8983/solr/collectionName/select?defType=dismax&q=video&qf=title^10 description^5 content
Or
bq=title:text^10 description:text^7 content:text^5.
You can add the boosting like above the to fields and it will give weight on those fields.
Please refer the more on the solr Documentation page. Solr Docs