lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Strict Ordering of Boosted results?
Date Wed, 06 Aug 2008 21:51:41 GMT

: word: termA^10.0   word: termB^2.0
: I want ALL termA results (ordered by score) to come before ANY termB
: results (also ordered by score). Is there a way to do this in the query
: syntax? Or is this simple multiple queries?

the syntax lets you specify the query boost on each clause, but those 
boost are just one factor in determining score -- the TF, IDF, and index 
time boosts (include length  norm) also come into play -- you can 
eliminate them by customizing your Similaity class.

that will get you *close* to what you want, but you still have to worry 
about hte possibility that doc will match termB, termC, etc.. but not 
termA ... the scores from all of those other terms added up might be 
higher then the score from a doc that matches termA -- but there is a 
solution tothis too: instead of a BooleanQuery you can use a 
DisjunctionMaxQuery with the tiebreaker value set to 0, which means that 
even if multiple clauses match only the one with the highest score will 
contribute to the document score -- since you've eliminated TF, IDF, and 
index time boosts, that will mean only your query boosts will matter.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message