Sammy: http://markmail.org/search/solr+function+query+recip?page=1
Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch ----- Original Message ---- > From: Sammy Yu <temi...@gmail.com> > To: solr-user@lucene.apache.org > Sent: Monday, December 15, 2008 5:28:17 PM > Subject: Re: Standard request with functional query > > Hey guys, > Thanks for the response, but how would make recency a factor on > scoring documents with the standard request handler. > The query (title:iphone OR bodytext:iphone OR title:firmware OR > bodytext:firmware) AND _val_:"ord(dateCreated)"^0.1 > seems to do something very similar to just sorting by dateCreated > rather than having dateCreated being a part of the score. > > Thanks, > Sammy > > n Thu, Dec 4, 2008 at 1:35 PM, Sammy Yu wrote: > > Hi guys, > > I have a standard query that searches across multiple text fields such as > > q=title:iphone OR bodytext:iphone OR title:firmware OR bodytext:firmware > > > > This comes back with documents that have iphone and firmware (I know I > > can use dismax handler but it seems to be really slow), which is > > great. Now I want to give some more weight to more recent documents > > (there is a dateCreated field in each document). > > > > So I've modified the query as such: > > (title:iphone OR bodytext:iphone OR title:firmware OR > > bodytext:firmware) AND _val_:"ord(dateCreated)"^0.1 > > URLencoded to > q=(title%3Aiphone+OR+bodytext%3Aiphone+OR+title%3Afirmware+OR+bodytext%3Afirmware)+AND+_val_%3A"ord(dateCreated)"^0.1 > > > > However, the results are not as one would expects. The first few > > documents only come back with the word iphone and appears to be sorted > > by date created. It seems to completely ignore the score and use the > > dateCreated field for the score. > > > > On a not directly related issue it seems like if you put the weight > > within the double quotes: > > (title:iphone OR bodytext:iphone OR title:firmware OR > > bodytext:firmware) AND _val_:"ord(dateCreated)^0.1" > > > > the parser complains: > > org.apache.lucene.queryParser.ParseException: Cannot parse > > '(title:iphone OR bodytext:iphone OR title:firmware OR > > bodytext:firmware) AND _val_:"ord(dateCreated)^0.1"': Expected ',' at > > position 16 in 'ord(dateCreated)^0.1' > > > > Thanks, > > Sammy > >