Hi Jan, I think that in your overall function you messed up a little with your time units. In your product function you try to get years from miliseconds: product(ms(NOW,date_field),3.16e-11)
... to have that value comparable with the value of -100 in your map function: map(product(ms(NOW,date_field),3.16e-11),-100,0,0) That's understandable. But when you already have your time value in "year" units, then you should follow with that and do not use miliseconds in your recip function. So in my opinion you should eihter use "year" value in your recipe function (so it would be a one year): recip(map(product(ms(NOW,date_field),3.16e-11),-100,0,0),1,1,1) or remove the product function - do not change miliseconds to years and use -3.16e13 instead of -100: recip(map(ms(NOW,date_field),-3.16e13,0,0),3.16e-11,1,1) I hope that helps, regards, Rafał Andrzejewski. W dniu 2014-02-26 13:44:41 użytkownik Jan Wedding <jan.wedd...@st.ovgu.de> napisał: > Hi, > > I have a small problem using function queries. According to > http://wiki.apache.org/solr/FunctionQuery#Date_Boosting and > http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents > > I've tried using function queries to boost newer documents over older > ones. For my case, I have documents with dates in the future, so I tried > to adapt the example: All dates in the future should have a boost > multiplier of 1. Therefore, I tried using the following function, so all > dates until 100 years in the future should get a 0 through the map > function, and all past dates should end up being used as they are after > the map function, resulting in a boost multiplier of 1 for all future > dates, and all past dates having the normal values of their age > according to the recip function: > > recip(map(product(ms(NOW,date_field),3.16e-11),-100,0,0),3.16e-11,1,1) > > Unfortunately, this does not seem to work - this function seems to > return 1 for any date_field value > > After that, I tried using a workaround, by emulating the recip function > using the div and product and sum functions: > div(1,sum(product(map(product(ms(NOW,date_field),3.16e-11),-100,0,0),3.16e-11),1)) > > This also did not work . > > Finally I checked, whether the map function returns correct values, by > executing the map function alone, so all future days should end up > having 0 for their score. This DID work. > map(product(ms(NOW,date_field),3.16e-11),-100,0,0) > > So my question now: Am I doing something wrong or is there a bug in the > recip function? > > I am currently using Solr 4.5.1. > > Thanks for your help, > Jan >