Boost Solr documents by age

The simplest way of boosting documents by age is by applying a reverse sort on age. If that's possible, then you're done!

In other cases where what you're after is a boost and not a sort, then read on!

The general idea here is to boost more recent documents and penalize older documents.

Example schema

<fieldType name="tdate" class="solr.TrieDateField" 
  omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
<field name="modify_date" type="tdate" indexed="true" stored="true" required="true" />


There are a number of ways to boost using functionqueries. One way is: recip + linear, where recip computes an age-based score, and linear is used to boost it.

The dismax query parser provides and easy way to apply boost functions. For example:


Another way is recip + ms:




Try a couple variations. Your mileage may vary.