Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 15862 invoked from network); 21 Feb 2010 21:25:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Feb 2010 21:25:43 -0000 Received: (qmail 38128 invoked by uid 500); 21 Feb 2010 21:25:43 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 38060 invoked by uid 500); 21 Feb 2010 21:25:43 -0000 Mailing-List: contact java-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-commits@lucene.apache.org Received: (qmail 38051 invoked by uid 99); 21 Feb 2010 21:25:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Feb 2010 21:25:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Feb 2010 21:25:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6E73123889BB; Sun, 21 Feb 2010 21:25:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r912407 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/TopScoreDocCollector.java Date: Sun, 21 Feb 2010 21:25:22 -0000 To: java-commits@lucene.apache.org From: uschindler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100221212522.6E73123889BB@eris.apache.org> Author: uschindler Date: Sun Feb 21 21:25:21 2010 New Revision: 912407 URL: http://svn.apache.org/viewvc?rev=912407&view=rev Log: LUCENE-2271: Fix javadocs of TopScoreDocCollector Modified: lucene/java/trunk/CHANGES.txt lucene/java/trunk/src/java/org/apache/lucene/search/TopScoreDocCollector.java Modified: lucene/java/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=912407&r1=912406&r2=912407&view=diff ============================================================================== --- lucene/java/trunk/CHANGES.txt (original) +++ lucene/java/trunk/CHANGES.txt Sun Feb 21 21:25:21 2010 @@ -612,10 +612,10 @@ code to implement this method. If you already extend IndexSearcher, no further changes are needed to use Collector. - Finally, the values Float.NaN, Float.NEGATIVE_INFINITY and - Float.POSITIVE_INFINITY are not valid scores. Lucene uses these - values internally in certain places, so if you have hits with such - scores, it will cause problems. (Shai Erera via Mike McCandless) + Finally, the values Float.NaN and Float.NEGATIVE_INFINITY are not + valid scores. Lucene uses these values internally in certain + places, so if you have hits with such scores, it will cause + problems. (Shai Erera via Mike McCandless) * LUCENE-1687: All methods and parsers from the interface ExtendedFieldCache have been moved into FieldCache. ExtendedFieldCache is now deprecated and @@ -693,7 +693,7 @@ * LUCENE-1575: As of 2.9, the core collectors as well as IndexSearcher's search methods that return top N results, no - longer filter out zero scoring documents. If you rely on this + longer filter documents with scores <= 0.0. If you rely on this functionality you can use PositiveScoresOnlyCollector like this: Modified: lucene/java/trunk/src/java/org/apache/lucene/search/TopScoreDocCollector.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TopScoreDocCollector.java?rev=912407&r1=912406&r2=912407&view=diff ============================================================================== --- lucene/java/trunk/src/java/org/apache/lucene/search/TopScoreDocCollector.java (original) +++ lucene/java/trunk/src/java/org/apache/lucene/search/TopScoreDocCollector.java Sun Feb 21 21:25:21 2010 @@ -29,10 +29,10 @@ * instance of this collector you should know in advance whether documents are * going to be collected in doc Id order or not. * - *

NOTE: The values Float.Nan, - * Float.NEGATIVE_INFINITY and Float.POSITIVE_INFINITY are - * not valid scores. This collector will not properly - * collect hits with such scores. + *

NOTE: The values {@link Float#NaN} and + * {Float#NEGATIVE_INFINITY} are not valid scores. This + * collector will not properly collect hits with such + * scores. */ public abstract class TopScoreDocCollector extends TopDocsCollector { @@ -45,6 +45,11 @@ @Override public void collect(int doc) throws IOException { float score = scorer.score(); + + // This collector cannot handle these scores: + assert score != Float.NEGATIVE_INFINITY; + assert !Float.isNaN(score); + totalHits++; if (score <= pqTop.score) { // Since docs are returned in-order (i.e., increasing doc Id), a document @@ -72,6 +77,10 @@ @Override public void collect(int doc) throws IOException { float score = scorer.score(); + + // This collector cannot handle NaN + assert !Float.isNaN(score); + totalHits++; doc += docBase; if (score < pqTop.score || (score == pqTop.score && doc > pqTop.doc)) {