Solr: How to dynamically elevate limited number of documents? Has QueryElevationComponent to be modified?

StackOverflow https://stackoverflow.com/questions/8864824

  •  16-04-2021
  •  | 
  •  

Question

my requirement is to elevate a limited number of (e.g. five) documents for a user request.

What I've got is a single document field which stores a numerical value similar to a boosting value which represents an elevator ranking value.

So a user query would return 5 documents with the highest elevator ranking value and the remaining documents to fill a page in regular order.

How to do that?

The QueryElevationComponent does only allow static query definitions. Boosting does not allow to boost a limited number of documents for the special elevator ranking field.

Do I have to write a modified QueryElevationComponent? If yes, are there good examples how to do that?

Or does another approach exists, I didnt catched up?

Thank you for any hints or ideas!

Was it helpful?

Solution 2

Found a solution using two separate requests.

First boost documents by that score field. Use pagination to limit the result. Take the unique document ids from the result page and boost these ones explicitly within a new request.

OTHER TIPS

I would have one of these two approaches:

Both these methods can produce unpredictable results (since the relevance model in Solr is very complex). However with the function query you are able to fine tune a bit more.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top