0

My schema is like below

<fields>   
    <field name="ProductId" type="int" indexed="true" stored="true" />    
    <field name="ProductName" type="string" indexed="true" stored="true" required="true" />
    <field name="ProductDesription" type="string" indexed="true" stored="true" required="true" />
    <field name="ProductRating" type="int" indexed="true" stored="true" required="true" />
</fields>

Product name will be passed as q parameter to solr. Is there a way to affect score on the basis of "ProductRating" which is not passed as query parameter ?

Or I need to go to solr source code and change the ranking algorithm ?

Please Guide me.

Thanks in advance

Ppm
  • 162
  • 1
  • 13

2 Answers2

1

If you want to sort by ProductRating, then simply append another query param like this: q=ProductName:book&sort=ProductRating desc or you can use ProductRating in a function query to influence the score.

arun
  • 10,685
  • 6
  • 59
  • 81
0

You can boost the results on the basis of the product rating.

Check e.g. Boost Score OR If you are using Dismax parser check for parameter Boost Query

For your condition you can try bq=ProductRating^2.0

You should probably use the combination of boost on the product name and product type to get proper results with a different weightage to account for the search else as in your case its just a Sort as replied by @Arun

Jayendra
  • 52,349
  • 4
  • 80
  • 90