solrsolr-boost

Solr: Boost by string field


How can I boost a query by a string field? I've found only resources explaining date boosting.

E.g. these documents should be boosted in this order:

  1. priority=a
  2. priority=b
  3. priority=c

I know, that I could sort by priority, but I want to combine this field with the solr relevancy mechanisms.


Solution

  • The solution is a boost function using rord()

    bf=rord(priority)^10
    

    rord maps a string to an integer, which can then be used for boosting.