: I've also tried getting the scores by walking the clauses of the
: BooleanQuery, but that doesn't seem to work either, because the
: queryNorm is off. For example, here's an original explanation for a
: 3-clause query, where one clause doesn't match:

a simple solution would be to eliminate the queryNorm completely (you can 
override it in your Similarity class) ... depending on your use case you 
might not need it at all.

: So how can I get the correct sub-scores for *all* clauses of a
: BooleanQuery, regardless of whether they matched or not?

well, first off: if a clause didn't match, then by definition there is no 
score to get from that clause ... but i'm guessing what you ment to say is 
how do you get the sub-scores from all of the clauses that *did* match, 
and know which clauses *didn't* match.

i haven't tried this, but i think something like this would work...

Weight tmp = yourBooleanQuery.weight(yourSearcher);
float norm = yourSearcher.getSimilarity().queryNorm(tmp.sumOfSquaredWeights());
for (BooleanClause c : yourBooleanQuery.getClauses()) {
   Weight w = c.getQuery().weight(yourSearcher);
   w.normalize(norm);
   doSomethingWithExplain(w.explain(yourReader, yourDocId));
}




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to