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?
Asked
Active
Viewed 1,063 times
1
-
apply the boosting to fields... as you can add the boost during query – Abhijit Bashetti Mar 16 '20 at 12:04
1 Answers
0
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

Abhijit Bashetti
- 8,518
- 7
- 35
- 47
-
After applying boost to fields, I want to sort the documents according to date, but first all documents where query matched in title field, then description and then content – Aniket Patil Mar 16 '20 at 12:56