8

I already have the boost determined before hand. I have a field in the solr index called boost1 . This boost field will have a value from 1 to 10 similar to google PR rank. This is the boost that should be applied to every query ran in solr. here are the fields in my index

  • Id
  • Title
  • Text
  • Boost1

The boost field should be apply to every query. I am trying to implement functionality similar to Google PR rank. Is there a way to do this using solr?

javanna
  • 59,145
  • 14
  • 144
  • 125
Luke101
  • 63,072
  • 85
  • 231
  • 359
  • 1
    This is still (from 2012) informative and helpful: https://nolanlawson.com/2012/06/02/comparing-boost-methods-in-solr/ – Risadinha Jun 21 '16 at 15:39

2 Answers2

13

you can add the boost during query e.g.

q={!boost b=boost1}

How_can_I_boost_the_score_of_newer_documents

However, this may need to be added explicitly by you.

If you are using dismax or edismax with the request handler, The bf (Boost Functions) parameter could be used to boost the documents. http://wiki.apache.org/solr/DisMaxQParserPlugin#bf_.28Boost_Functions.29

bf=boost1^0.5

This can be added to defaults with the request handler definition, so that they are applied to all the search queries.

you can use function queries to vary the amount of boost FunctionQuery

YoungHobbit
  • 13,254
  • 9
  • 50
  • 73
Jayendra
  • 52,349
  • 4
  • 80
  • 90
  • Hi, How to do a more complex function query to achieve a boost using multiplication.. pls check at http://stackoverflow.com/questions/19874983/use-function-query-for-boosting-score-in-solr – Krutal Modi Nov 09 '13 at 10:40
  • You might want to prefer the `boost` (multiplicative boost) to the `bf` (additive boost) parameter in `edismax` queries. An article that sheds some light on the all the different parameters: https://nolanlawson.com/2012/06/02/comparing-boost-methods-in-solr/ – Risadinha Dec 22 '16 at 16:19
  • Works for me, great! But I don't understand why. I don't find anything about `!boost b=...` in the Reference Guide of Solr 8.x or 9.x. Could you give some more explanation about what is going on exactly? The links you provided are not valid anymore. – TOG Apr 04 '23 at 15:41
0

I think you need to use index time document boosts. See this if you are indexing XML or this if using DataImportHandler.

nikhil500
  • 3,458
  • 19
  • 23