I am trying to boost relevancy based on a date field with dismax, and I've included the requestHandler config below. The post_date field in my database is simple UNIX time, seconds since epoch. It's in a MySQL bigint field, so I've stored it as a tlong in Solr. This filed is required by our application in integer format.

You can see a boost function commented out below that I tried to use, which should multiply the post_date by 1000 to match the Solr way of milliseconds since epoch, then use a reciprocal example similar to one I found on the Solr Wiki. When I uncomment it, I get an error message:

Problem accessing /solr/ncmain/select. Reason:
    undefined field product(post_date

Lance Norskog mentioned that boost functions are slow, and suggested that I use something like the following query, which I am willing to try, but I first have to get my "seconds since epoch" into a format that Solr can use. So, I need two things that I cannot figure out how to do. One is schema.xml (or DIH, maybe?) config to convert the date format into an additional field, the other is exactly what to put in the dismax requestHandler to automatically include the boost.

[NOW-6MONTHS TO NOW]^5.0 ,
[NOW-1YEARS TO NOW-6MONTHS]^3.0
[NOW-2YEARS TO NOW-1YEARS]^2.0
[* TO NOW-2YEARS]^1.0

My current dismax requestHandler, some of which is still a work in progress:

<requestHandler name="dismax" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">dismax</str>
<bool name="partialResults">true</bool>
<int name="timeAllowed">6000</int>
<str name="echoParams">explicit</str>
<int name="rows">50</int>
<str name="shards">idxinc:8983/solr/live,idxst0-b:8983/solr/live,idxst1-b:8983/solr/live,idxst2-b:8983/solr/live,idxst3-b:8983/solr/live,idxst4-b:8983/solr/live,idxst5-b:8983/solr/live</str>
<float name="tie">0.1</float>
<str name="qf">doc_id^5 text_preview^1.25 ft_text keywords^0.75 ft_dname^1.25</str> <str name="pf">doc_id^5 text_preview^1.25 ft_text keywords^0.75 ft_dname^1.25</str>
<!--
<str name="bf">recip(ms(NOW,product(post_date,1000)),3.17e-11,1,1)</str>
-->
<str name="fl">score,*</str>
<str name="mm">0&lt;-1 4&lt;-50%</str>
<str name="q.alt">*:*</str>
</lst>
</requestHandler>

Reply via email to