Seems like we don't respect segments that don't return hits for a
certain query....
Index: lucene/src/java/org/apache/lucene/search/IndexSearcher.java
===================================================================
--- lucene/src/java/org/apache/lucene/search/IndexSearcher.java (revision
1066751)
+++ lucene/src/java/org/apache/lucene/search/IndexSearcher.java (working copy)
@@ -373,8 +373,10 @@
int totalHits = 0;
float maxScore = Float.NEGATIVE_INFINITY;
for (final TopDocs topDocs : runner) {
- totalHits += topDocs.totalHits;
- maxScore = Math.max(maxScore, topDocs.getMaxScore());
+ if(topDocs.totalHits != 0) {
+ totalHits += topDocs.totalHits;
+ maxScore = Math.max(maxScore, topDocs.getMaxScore());
+ }
}
final ScoreDoc[] scoreDocs = new ScoreDoc[hq.size()];
@@ -451,8 +453,10 @@
int totalHits = 0;
float maxScore = Float.NEGATIVE_INFINITY;
for (final TopFieldDocs topFieldDocs : runner) {
- totalHits += topFieldDocs.totalHits;
- maxScore = Math.max(maxScore, topFieldDocs.getMaxScore());
+ if (topFieldDocs.totalHits != 0) {
+ totalHits += topFieldDocs.totalHits;
+ maxScore = Math.max(maxScore, topFieldDocs.getMaxScore());
+ }
}
final ScoreDoc[] scoreDocs = new ScoreDoc[hq.size()];
for (int i = hq.size() - 1; i >= 0; i--) // put docs in array
the tests pass if I check the number of hits though - I will commit in a second
simon
On Thu, Feb 3, 2011 at 6:09 AM, Apache Hudson Server
<[email protected]> wrote:
> Build: https://hudson.apache.org/hudson/job/Lucene-Solr-tests-only-trunk/4442/
>
> 1 tests failed.
> REGRESSION: org.apache.lucene.search.payloads.TestPayloadTermQuery.test
>
> Error Message:
> NaN does not equal: 1
>
> Stack Trace:
> junit.framework.AssertionFailedError: NaN does not equal: 1
> at
> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1183)
> at
> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1115)
> at
> org.apache.lucene.search.payloads.TestPayloadTermQuery.test(TestPayloadTermQuery.java:149)
>
>
>
>
> Build Log (for compile errors):
> [...truncated 2961 lines...]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]