You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Peter Keegan <pe...@gmail.com> on 2007/08/30 21:40:53 UTC

BoostingTermQuery.explain() bugs

There are a couple of minor bugs in BoostingTermQuery.explain().

1. The computation of average payload score produces NaN if no payloads were
found. It should probably be:
float avgPayloadScore = super.score() * (payloadsSeen > 0 ? (payloadScore /
payloadsSeen) : 1);

2. If the average payload score is zero, the value of the explanation is 0:
result.setValue(nonPayloadExpl.getValue() * avgPayloadScore);
If the query is part of a BooleanClause, this results in:
"no match on required clause..."
"failure to meet condition(s) of required/prohibited clause(s)"

Let me know if I should open a JIRA issue.

Peter

Re: BoostingTermQuery.explain() bugs

Posted by Chris Hostetter <ho...@fucit.org>.
> Yes.  JUnit would also be good, if you have it.

if you want to write some there is a lot of good helper code already out 
there for making sure the hits and scores produced by a query match the 
explanations produced by that same query...

chrish@asimov:~/svn/lucene-clean$ ls src/test/org/apache/lucene/search/*Explan*
src/test/org/apache/lucene/search/TestComplexExplanations.java
src/test/org/apache/lucene/search/TestComplexExplanationsOfNonMatches.java
src/test/org/apache/lucene/search/TestExplanations.java
src/test/org/apache/lucene/search/TestSimpleExplanations.java
src/test/org/apache/lucene/search/TestSimpleExplanationsOfNonMatches.java

you could add directly to TestSimpleExplanations and 
TestComplexExplanations assuming you modify the index 
TestExplanations.setUp to include some payload data ... then you get the 
testing of NonMatches for free.



-Hoss

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


Re: BoostingTermQuery.explain() bugs

Posted by Grant Ingersoll <gs...@apache.org>.
On Aug 30, 2007, at 3:40 PM, Peter Keegan wrote:

> There are a couple of minor bugs in BoostingTermQuery.explain().
>
> 1. The computation of average payload score produces NaN if no  
> payloads were
> found. It should probably be:
> float avgPayloadScore = super.score() * (payloadsSeen > 0 ?  
> (payloadScore /
> payloadsSeen) : 1);
>
> 2. If the average payload score is zero, the value of the  
> explanation is 0:
> result.setValue(nonPayloadExpl.getValue() * avgPayloadScore);
> If the query is part of a BooleanClause, this results in:
> "no match on required clause..."
> "failure to meet condition(s) of required/prohibited clause(s)"
>
> Let me know if I should open a JIRA issue.
>

Yes.  JUnit would also be good, if you have it.





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