lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Bethard <beth...@stanford.edu>
Subject sub-scores for all clauses in a BooleanQuery
Date Fri, 17 Apr 2009 21:20:50 GMT
I have a BooleanQuery with several clauses. After running a search, in
addition to seeing the overall score of each document, I need to see the
sub-score produced by each clause. When all clauses match, this is
relatively easy to get back by ".explain(...)", which gives me something
like this:

0.32073945 = sum of:
  0.31007314 = ...
  0.009919861 = ...
  7.4644934E-4 = ...

I can then get the sub-scores by and calling ".getValue()" on each of
the Explanation details.

However, when one or more clauses are not considered to be matches, they
are simply dropped from the explanation. So then I get something like:

0.17179786 = sum of:
  0.17119168 = ...
  6.0617714E-4 = ...

Since the clause that didn't match was simply dropped from the
Explanation, I can no longer use the ".explain(...)" + ".getValue()"
trick because I don't know which clause was dropped.

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:

0.17179786 = sum of:
  0.17119168 = product of:
    0.23752846 = sum of:
    0.7207207 = coord(80/111)
  6.0617714E-4 = float(citationCount)^0.01, product of:
    2.0 = float(citationCount)=2.0
    0.01 = boost
    0.030308858 = queryNorm

And here's what I get if I ask for an explanation from each clause
individually:

0.1711924 = product of:
  0.23752946 = sum of:
  0.7207207 = coord(80/111)

0.0 = product of:
  0.0 = sum of:
  0.0 = coord(0/2)

2.0 = float(citationCount)^0.01, product of:
  2.0 = float(citationCount)=2.0
  0.01 = boost
  100.0 = queryNorm

Notice that the last explanation gets a score of 2.0 instead of
6.0617714E-4.

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

Thanks,

Steve

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


Mime
View raw message