On 3/9/06, Yang Sun <[EMAIL PROTECTED]> wrote: > Hi Yonik, > Thanks very much for your suggestion. The query boost works great for > keyword matching. But in my case, I need to rank the results by date and > title. For example, title:foo^2 abstract:foo^1.5 date:2004^3 will only boost > the document with date=2004. What I need is boosting the "distance" from the > specified date
If all you need to do is boost more recent documents (and a single fixed boost will always work), then you can do that boosting at index time. > which means 2003 will have a better ranking than 2002, > 2002>2001, etc. > I implemented a customized ScoreDocComparator class which works fine for one > field. But I met some trouble when trying to combine other fields together. > I'm still looking at FunctionQuery. Don't know if I can figure out > something. FunctionQuery support is integrated into Solr (or currently hacked-in, as the case may be), and can be useful for debugging and trying out query types even if you don't use it for your runtime. ReciprocalFloatFunction might meet your needs for increasing the score of more recent documents: http://incubator.apache.org/solr/docs/api/org/apache/solr/search/function/ReciprocalFloatFunction.html The SolrQueryParser can make ReciprocalFloatFunction(new ReverseOrdFieldSource("my_date"),1,1000,1000) out of _val_:"recip(rord(my_date),1,1000,1000)" -Yonik http://incubator.apache.org/solr Solr, The Open Source Lucene Search Server --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]