lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1384853 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
Date Fri, 14 Sep 2012 17:16:56 GMT
Author: mikemccand
Date: Fri Sep 14 17:16:55 2012
New Revision: 1384853

URL: http://svn.apache.org/viewvc?rev=1384853&view=rev
Log:
improve comments; throw UOE from BS.freq() since it's not a doc-at-a-time scorer

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java?rev=1384853&r1=1384852&r2=1384853&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
Fri Sep 14 17:16:55 2012
@@ -332,7 +332,14 @@ public class BooleanQuery extends Query 
           optional.add(subScorer);
         }
       }
-      
+
+      // NOTE: we could also use BooleanScorer, if we knew
+      // this BooleanQuery was embedded in another
+      // BooleanQuery that was also using BooleanScorer (ie,
+      // BooleanScorer can nest).  But this is hard to
+      // detect and we never do so today... (ie, we only
+      // return BooleanScorer for topScorer):
+
       // Check if we can return a BooleanScorer
       if (!scoreDocsInOrder && topScorer && required.size() == 0) {
         return new BooleanScorer(this, disableCoord, minNrShouldMatch, optional, prohibited,
maxCoord);

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java?rev=1384853&r1=1384852&r2=1384853&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
Fri Sep 14 17:16:55 2012
@@ -254,7 +254,12 @@ final class BooleanScorer extends Scorer
           // clauses
           //&& (current.bits & requiredMask) == requiredMask) {
           
-          // TODO: can we remove this?  
+          // NOTE: Lucene always passes max =
+          // Integer.MAX_VALUE today, because we never embed
+          // a BooleanScorer inside another (even though
+          // that should work)... but in theory an outside
+          // app could pass a different max so we must check
+          // it:
           if (current.doc >= max){
             tmp = current;
             current = current.next;
@@ -318,7 +323,7 @@ final class BooleanScorer extends Scorer
 
   @Override
   public float freq() throws IOException {
-    return current.coord;
+    throw new UnsupportedOperationException();
   }
 
   @Override



Mime
View raw message