0

The solr elevate component only works for keyword query. In my project, I want to use elevate component to boost the documents that satisfying a custom parameter in query. For example, q=foo&fq:type=car. In this case, does anyone know how to elevate the documents with fq type car when the query is foo? It should be noted that I do not want to elevate the documents when the query is just q=foo.

Jayendra
  • 52,349
  • 4
  • 80
  • 90
Xiao
  • 555
  • 1
  • 5
  • 19

1 Answers1

1

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

For your condition you can try bq=type:car^2.0

Jayendra
  • 52,349
  • 4
  • 80
  • 90
  • In my project, if the type of a document is book, I do not want to elevate it. Will your approach work? – Xiao Jan 22 '13 at 04:49
  • yes .. this will only boost the results higher for type car and not others. – Jayendra Jan 22 '13 at 04:52
  • For Solr elevation component, I only want to elevate some specific documents. I want to do something like this. – Xiao Jan 22 '13 at 14:14
  • you should use boost instead of elevation. – Jayendra Jan 23 '13 at 03:52
  • I just modified QueryElevationComponent to do this. The elevate.xml file can be thought as a rule table, such as "if q=foo, then elevate doc 1 and doc2". I change the QueryElevationComponent code to let it understand rule like "if q=foo and type=car, then elevate doc 1 and doc 2". It is not so hard. – Xiao Jan 24 '13 at 03:02