0

How to boost record depend on any field in Solr.

Reference link :https://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_increase_the_score_for_specific_documents

But I am not getting clearlly in my case.

I have some record after search

enter image description here

How to get Id : 5,8,17 and 1 up some step not top of the list, just boost some step.Because it's price is higher.

It's my row query ;

select?mm=100%25&version=2.2&q=(book)&defType=edismax&spellcheck.q=(book)&qf=Price^10+Name^1+nGramContent&spellcheck=true&stats=true&facet.mincount=1&facet=true&spellcheck.collate=true&stats.field=Price&rows=50&indent=on&wt=json&fl=Id,score,Price

Please help me.

Thanks!

Kalpesh Boghara
  • 418
  • 3
  • 22

1 Answers1

0

The qf parameters are for hits in the field and will not affect the ranking unless the query produces a hit in the field. Your example would require you to search for the price (and not book) for anything to be boosted by the qf=Price^10 argument.

The FAQ you've linked to answers your question, just not the question you've referenced: How can I change the score of a document based on the value of a field. From the example (replace popularity with price for your case):

# simple boosts by popularity
defType=dismax&qf=text&q=supervillians&bf=popularity
q={!boost b=popularity}text:supervillians

# boosts based on complex functions of the popularity field
defType=dismax&qf=text&q=supervillians&bf=sqrt(popularity)
q={!boost b=sqrt(popularity)}text:supervillians

edismax makes the {!boost} (multiplicative boost) available as the boost= parameter as well, so you can reference it directly instead of having it in your query.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • Lindh You are wrong using scale function we can do this. bf=scale(DisplayOrder,0,100)^10. Have any idea how to use this in solrNet? – Kalpesh Boghara Jul 14 '16 at 12:32
  • @KalpeshBoghara That's exactly what I suggested, using either `bf` or `boost` (additive vs multiplicative). In Solrnet you can use extraParams, see https://stackoverflow.com/questions/29147725/how-do-i-pass-multiple-bq-arguments-to-localparams-in-solrnet – MatsLindh Jul 14 '16 at 12:44