Return-Path: Delivered-To: apmail-incubator-jackrabbit-commits-archive@www.apache.org Received: (qmail 47246 invoked from network); 23 Jan 2006 10:44:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Jan 2006 10:44:40 -0000 Received: (qmail 22389 invoked by uid 500); 23 Jan 2006 10:44:39 -0000 Mailing-List: contact jackrabbit-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-commits@incubator.apache.org Received: (qmail 22378 invoked by uid 500); 23 Jan 2006 10:44:39 -0000 Delivered-To: apmail-incubator-jackrabbit-cvs@incubator.apache.org Received: (qmail 22375 invoked by uid 99); 23 Jan 2006 10:44:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2006 02:44:39 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 23 Jan 2006 02:44:38 -0800 Received: (qmail 47139 invoked by uid 65534); 23 Jan 2006 10:44:18 -0000 Message-ID: <20060123104418.47138.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r371520 - /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java Date: Mon, 23 Jan 2006 10:44:18 -0000 To: jackrabbit-cvs@incubator.apache.org From: mreutegg@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: mreutegg Date: Mon Jan 23 02:44:15 2006 New Revision: 371520 URL: http://svn.apache.org/viewcvs?rev=371520&view=rev Log: (empty) Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java?rev=371520&r1=371519&r2=371520&view=diff ============================================================================== --- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java (original) +++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java Mon Jan 23 02:44:15 2006 @@ -27,6 +27,8 @@ import java.io.IOException; import java.util.BitSet; +import java.util.Map; +import java.util.HashMap; /** * Implements a lucene Query which filters a sub query by checking @@ -36,6 +38,11 @@ class DescendantSelfAxisQuery extends Query { /** + * Default score is 1.0f. + */ + private static final Float DEFAULT_SCORE = new Float(1.0f); + + /** * The context query */ private final Query contextQuery; @@ -205,6 +212,15 @@ private final BitSet subHits; /** + * Map that contains the scores for the sub hits. To save memory + * only scores that are not equal to 1.0f are put to this map. + *

+ * key=[Integer] id of selected document from sub query
+ * value=[Float] score for that document + */ + private final Map scores = new HashMap(); + + /** * The next document id to return */ private int nextDoc = -1; @@ -278,7 +294,11 @@ * {@inheritDoc} */ public float score() throws IOException { - return 1.0f; + Float score = (Float) scores.get(new Integer(nextDoc)); + if (score == null) { + score = DEFAULT_SCORE; + } + return score.floatValue(); } /** @@ -304,6 +324,9 @@ subScorer.score(new HitCollector() { public void collect(int doc, float score) { subHits.set(doc); + if (score != DEFAULT_SCORE.floatValue()) { + scores.put(new Integer(doc), new Float(score)); + } } }); }