lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r885369 - /lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java
Date Mon, 30 Nov 2009 10:00:41 GMT
Author: uschindler
Date: Mon Nov 30 10:00:40 2009
New Revision: 885369

URL: http://svn.apache.org/viewvc?rev=885369&view=rev
Log:
Further update in NumericRangeTermsEnum:
- seek() cannot work for this TermsEnum, so throw UOE (is not needed for MTQ at the moment)
- if after seek SeekStatus.END is returned, we cannot seek anymore, so exit enumeration.

Modified:
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java?rev=885369&r1=885368&r2=885369&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java
Mon Nov 30 10:00:40 2009
@@ -502,23 +502,31 @@
       return 1.0f;
     }
     
-    /** this is a dummy, it is not used by this class. */
     @Override
     public boolean empty() {
       return empty;
     }
 
-    /** this is a dummy, it is not used by this class. */
     @Override
     protected TermRef setEnum(TermsEnum actualEnum, TermRef term) throws IOException {
       throw new UnsupportedOperationException("not implemented");
     }
+
+    @Override
+    public SeekStatus seek(TermRef term) throws IOException {
+      throw new UnsupportedOperationException("not implemented");
+    }
+
+    @Override
+    public SeekStatus seek(long ord) throws IOException {
+      throw new UnsupportedOperationException("not implemented");
+    }
     
     @Override
     public String field() {
       return field;
     }
-
+    
     @Override
     protected AcceptStatus accept(TermRef term) {
       return (termComp.compare(term, currentUpperBound) <= 0) ?
@@ -527,13 +535,14 @@
 
     @Override
     public TermRef next() throws IOException {
-      if (actualEnum == null)
+      if (actualEnum == null) {
         return null;
+      }
       
       // try change to next term, if no such term exists, fall-through
       // (we can only do this if the enum was already seeked)
       if (currentUpperBound != null) {
-        TermRef term = actualEnum.next();
+        final TermRef term = actualEnum.next();
         if (term != null && accept(term) == AcceptStatus.YES) {
           return term;
         }
@@ -550,11 +559,13 @@
         this.currentUpperBound = new TermRef(rangeBounds.removeFirst());
 
         SeekStatus status = actualEnum.seek(lowerBound);
-        if (status != SeekStatus.END) {
-          final TermRef term = actualEnum.term();
-          if (accept(term) == AcceptStatus.YES) {
-            return term;
-          }
+        if (status == SeekStatus.END) {
+          return null;
+        }
+        
+        final TermRef term = actualEnum.term();
+        if (accept(term) == AcceptStatus.YES) {
+          return term;
         }
       }
       



Mime
View raw message