lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romseyg...@apache.org
Subject svn commit: r1643846 - in /lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene: index/DocsEnum.java search/PositionQueue.java search/posfilter/Interval.java search/posfilter/NonOverlappingQuery.java search/posfilter/OrderedNearQuery.java
Date Mon, 08 Dec 2014 16:05:00 GMT
Author: romseygeek
Date: Mon Dec  8 16:05:00 2014
New Revision: 1643846

URL: http://svn.apache.org/r1643846
Log:
LUCENE-2878: Set NO_MORE_POSITIONS to be -1

Modified:
    lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
    lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java
    lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/Interval.java
    lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/NonOverlappingQuery.java
    lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/OrderedNearQuery.java

Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java?rev=1643846&r1=1643845&r2=1643846&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
(original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
Mon Dec  8 16:05:00 2014
@@ -51,7 +51,7 @@ public abstract class DocsEnum extends D
    *  if you require payloads in the returned enum. */
   public static final int FLAG_PAYLOADS = 0xB;
 
-  public static final int NO_MORE_POSITIONS = Integer.MAX_VALUE;
+  public static final int NO_MORE_POSITIONS = -1;
 
   private AttributeSource atts = null;
 

Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java?rev=1643846&r1=1643845&r2=1643846&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java
(original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java
Mon Dec  8 16:05:00 2014
@@ -54,6 +54,10 @@ public class PositionQueue extends Prior
         return -1;
       if (this.docsEnum.docID() > o.docsEnum.docID())
         return 1;
+      if (this.start == DocsEnum.NO_MORE_POSITIONS)
+        return 1;
+      if (o.start == DocsEnum.NO_MORE_POSITIONS)
+        return -1;
       return Integer.compare(this.start, o.start);
     }
   }

Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/Interval.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/Interval.java?rev=1643846&r1=1643845&r2=1643846&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/Interval.java
(original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/Interval.java
Mon Dec  8 16:05:00 2014
@@ -179,7 +179,7 @@ class Interval implements Cloneable {
    */
   public void setMaximum() {
     offsetBegin = offsetEnd = -1;
-    begin = end = Integer.MAX_VALUE;
+    begin = end = DocsEnum.NO_MORE_POSITIONS;
   }
   
   @Override

Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/NonOverlappingQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/NonOverlappingQuery.java?rev=1643846&r1=1643845&r2=1643846&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/NonOverlappingQuery.java
(original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/NonOverlappingQuery.java
Mon Dec  8 16:05:00 2014
@@ -136,6 +136,8 @@ public final class NonOverlappingQuery e
 
   static class BrouwerianScorer extends PositionFilteredScorer {
 
+    private static final int UNPOSITIONED = -2;
+
     private final Scorer subtrahend;
     private Interval subtInterval = new Interval();
     private int subtPosition = -1;
@@ -151,7 +153,7 @@ public final class NonOverlappingQuery e
       if (this.subtrahend == null || this.subtrahend.docID() == NO_MORE_DOCS || this.subtrahend.advance(doc)
!= doc)
         subtPosition = NO_MORE_POSITIONS;
       else
-        subtPosition = -1;
+        subtPosition = UNPOSITIONED;
       this.subtInterval.reset();
     }
 

Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/OrderedNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/OrderedNearQuery.java?rev=1643846&r1=1643845&r2=1643846&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/OrderedNearQuery.java
(original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/OrderedNearQuery.java
Mon Dec  8 16:05:00 2014
@@ -17,12 +17,12 @@ package org.apache.lucene.search.posfilt
  * limitations under the License.
  */
 
+import java.io.IOException;
+
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.similarities.Similarity;
 
-import java.io.IOException;
-
 /**
  * A query that matches if a set of subqueries also match, and are within
  * a given distance of each other within the document.  The subqueries



Mime
View raw message