You might want to play with both boosting and multiple sorting. You might want to look at something like Solr's boost queries or boost functions http://wiki.apache.org/solr/DisMaxRequestHandler#head-6862070cf279d9a09bdab971309135c7aea22fb3
Or if you want to go down the path of a custom score, most folks override the customScore method of CustomScoreQuery *//create a term query to search against all documents* Query tq = *new* TermQuery(*new* Term(*"metafile"*, *"doc"*)); FieldScoreQuery fsQuery = *new* FieldScoreQuery(*"geo_distance"*, Type.FLOAT); CustomScoreQuery customScore = *new* CustomScoreQuery(tq,fsQuery){ @Override *public* *float* customScore(*int* doc, *float* subQueryScore, *float* valSrcScore){ ..... return myFunkyScore; } } You can see a quick version in http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java?revision=762801&view=markup HTH P On Tue, Apr 7, 2009 at 9:01 AM, Tim Williams <william...@gmail.com> wrote: > On Tue, Apr 7, 2009 at 3:08 AM, Jinming Zhang <spee.zh...@gmail.com> > wrote: > > Hi, > > > > I have the following situation which needs to customize the final score > > according to field value. > > > > Suppose there are two docs in my query result, and they are ordered by > > default score sort: > > > > doc1(field1:bookA, field2:2000-01-01) -- score:0.80 > > doc2(field1:bookB, filed2:2009-01-01) -- score:0.70 > > > > I want "doc2" to have a higher score since it's publishing date is more > > recent, while "doc1" to have a lower score: > > > > doc2(field1:bookB, filed2:2009-01-01) -- score:0.77 > > doc1(field1:bookA, field2:2000-01-01) -- score:0.73 > > > > I found this scenario is different from doc.setBoost() and > field.setBoost(). > > Is there any way to impact the score calculated for "doc1" & "doc2" > > according to the value of "field2"? > > > > Thank you in advance! > > If you have access to the MEAP for Lucine In Action 2nd Edition, it > demonstrates using a CustomScoreQuery[1] for to boost a docs score > based on recency. > > --tim > > [1] - > http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/search/function/CustomScoreQuery.html > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >