lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1528173 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/expressions/ lucene/expressions/src/java/org/apache/lucene/expressions/ lucene/expressions/src/test/org/apache/lucene/expressions/ lucene/queries/ lucene/queries/src/java/org/a...
Date Tue, 01 Oct 2013 18:36:14 GMT
Author: rmuir
Date: Tue Oct  1 18:36:14 2013
New Revision: 1528173

URL: http://svn.apache.org/r1528173
Log:
LUCENE-5247: expressions should use DoubleDocValues not FunctionValues directly

Added:
    lucene/dev/branches/branch_4x/lucene/expressions/src/test/org/apache/lucene/expressions/TestExpressionValueSource.java
      - copied unchanged from r1528167, lucene/dev/trunk/lucene/expressions/src/test/org/apache/lucene/expressions/TestExpressionValueSource.java
Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/expressions/   (props changed)
    lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionComparator.java
    lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java
    lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionValueSource.java
    lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreFunctionValues.java
    lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreValueSource.java
    lucene/dev/branches/branch_4x/lucene/queries/   (props changed)
    lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java
    lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java
    lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java
    lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java
    lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java
    lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java

Modified: lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionComparator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionComparator.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionComparator.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionComparator.java
Tue Oct  1 18:36:14 2013
@@ -49,7 +49,7 @@ class ExpressionComparator extends Field
     try {
       Map<String,Object> context = new HashMap<String,Object>();
       assert scorer != null;
-      context.put("scorer", new ScoreFunctionValues(scorer));
+      context.put("scorer", scorer);
       scores = source.getValues(context, readerContext);
     } catch (IOException e) {
       throw new RuntimeException(e);

Modified: lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java
Tue Oct  1 18:36:14 2013
@@ -17,16 +17,19 @@ package org.apache.lucene.expressions;
  */
 
 import org.apache.lucene.queries.function.FunctionValues;
+import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.queries.function.docvalues.DoubleDocValues;
 
 /** A {@link FunctionValues} which evaluates an expression */
-class ExpressionFunctionValues extends FunctionValues {
+class ExpressionFunctionValues extends DoubleDocValues {
   final Expression expression;
   final FunctionValues[] functionValues;
   
   int currentDocument = -1;
   double currentValue;
   
-  public ExpressionFunctionValues(Expression expression, FunctionValues[] functionValues)
{
+  ExpressionFunctionValues(ValueSource parent, Expression expression, FunctionValues[] functionValues)
{
+    super(parent);
     if (expression == null) {
       throw new NullPointerException();
     }
@@ -46,14 +49,4 @@ class ExpressionFunctionValues extends F
     
     return currentValue;
   }
-  
-  @Override
-  public Object objectVal(int doc) {
-    return doubleVal(doc);
-  }
-  
-  @Override
-  public String toString(int document) {    
-    return "ExpressionFunctionValues(" + document + ": " + objectVal(document) + ")";
-  }
 }

Modified: lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionValueSource.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionValueSource.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionValueSource.java
Tue Oct  1 18:36:14 2013
@@ -17,6 +17,7 @@ package org.apache.lucene.expressions;
  */
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -79,7 +80,7 @@ final class ExpressionValueSource extend
       externalValues[i] = values;
     }
 
-    return new ExpressionFunctionValues(expression, externalValues);
+    return new ExpressionFunctionValues(this, expression, externalValues);
   }
 
   @Override
@@ -89,19 +90,48 @@ final class ExpressionValueSource extend
 
   @Override
   public String description() {
-    return "ExpressionValueSource(" + expression.sourceText + ")";
+    return "expr(" + expression.sourceText + ")";
   }
-
+  
   @Override
   public int hashCode() {
-    return System.identityHashCode(this);
+    final int prime = 31;
+    int result = 1;
+    result = prime * result
+        + ((expression == null) ? 0 : expression.hashCode());
+    result = prime * result + (needsScores ? 1231 : 1237);
+    result = prime * result + Arrays.hashCode(variables);
+    return result;
   }
-  
+
   @Override
   public boolean equals(Object obj) {
-    return obj == this;
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    ExpressionValueSource other = (ExpressionValueSource) obj;
+    if (expression == null) {
+      if (other.expression != null) {
+        return false;
+      }
+    } else if (!expression.equals(other.expression)) {
+      return false;
+    }
+    if (needsScores != other.needsScores) {
+      return false;
+    }
+    if (!Arrays.equals(variables, other.variables)) {
+      return false;
+    }
+    return true;
   }
-  
+
   boolean needsScores() {
     return needsScores;
   }

Modified: lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreFunctionValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreFunctionValues.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreFunctionValues.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreFunctionValues.java
Tue Oct  1 18:36:14 2013
@@ -19,15 +19,18 @@ package org.apache.lucene.expressions;
 import java.io.IOException;
 
 import org.apache.lucene.queries.function.FunctionValues;
+import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.queries.function.docvalues.DoubleDocValues;
 import org.apache.lucene.search.Scorer;
 
 /**
  * A utility class to allow expressions to access the score as a {@link FunctionValues}.
  */
-class ScoreFunctionValues extends FunctionValues {
+class ScoreFunctionValues extends DoubleDocValues {
   final Scorer scorer;
 
-  ScoreFunctionValues(Scorer scorer) {
+  ScoreFunctionValues(ValueSource parent, Scorer scorer) {
+    super(parent);
     this.scorer = scorer;
   }
   
@@ -40,9 +43,4 @@ class ScoreFunctionValues extends Functi
       throw new RuntimeException(exception);
     }
   }
-  
-  @Override
-  public String toString(int document) {
-    return "ScoreFunctionValues(" + document + ": " + doubleVal(document) + ")";
-  }
 }

Modified: lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreValueSource.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreValueSource.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ScoreValueSource.java
Tue Oct  1 18:36:14 2013
@@ -20,27 +20,28 @@ package org.apache.lucene.expressions;
 import org.apache.lucene.index.AtomicReaderContext;
 import org.apache.lucene.queries.function.FunctionValues;
 import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.search.Scorer;
 
 import java.io.IOException;
 import java.util.Map;
 
 /**
- * A {@link ValueSource} which uses the {@link ScoreFunctionValues} passed through
+ * A {@link ValueSource} which uses the {@link Scorer} passed through
  * the context map by {@link ExpressionComparator}.
  */
 @SuppressWarnings({"rawtypes"})
 class ScoreValueSource extends ValueSource {
 
   /**
-   * <code>context</code> must contain a key "scorer" which is a {@link FunctionValues}.
+   * <code>context</code> must contain a key "scorer" which is a {@link Scorer}.
    */
   @Override
   public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws
IOException {
-    FunctionValues v = (FunctionValues) context.get("scorer");
+    Scorer v = (Scorer) context.get("scorer");
     if (v == null) {
       throw new IllegalStateException("Expressions referencing the score can only be used
for sorting");
     }
-    return v;
+    return new ScoreFunctionValues(this, v);
   }
 
   @Override
@@ -55,6 +56,6 @@ class ScoreValueSource extends ValueSour
 
   @Override
   public String description() {
-    return "ValueSource to expose scorer passed by ExpressionComparator";
+    return "score()";
   }
 }

Modified: lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java
Tue Oct  1 18:36:14 2013
@@ -17,8 +17,10 @@ package org.apache.lucene.queries.functi
  * limitations under the License.
  */
 
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.queries.function.FunctionValues;
 import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.queries.function.ValueSourceScorer;
 import org.apache.lucene.util.mutable.MutableValue;
 import org.apache.lucene.util.mutable.MutableValueDouble;
 
@@ -80,6 +82,64 @@ public abstract class DoubleDocValues ex
   public String toString(int doc) {
     return vs.description() + '=' + strVal(doc);
   }
+  
+  @Override
+  public ValueSourceScorer getRangeScorer(IndexReader reader, String lowerVal, String upperVal,
boolean includeLower, boolean includeUpper) {
+    double lower,upper;
+
+    if (lowerVal==null) {
+      lower = Double.NEGATIVE_INFINITY;
+    } else {
+      lower = Double.parseDouble(lowerVal);
+    }
+
+     if (upperVal==null) {
+      upper = Double.POSITIVE_INFINITY;
+    } else {
+      upper = Double.parseDouble(upperVal);
+    }
+
+    final double l = lower;
+    final double u = upper;
+
+
+    if (includeLower && includeUpper) {
+      return new ValueSourceScorer(reader, this) {
+        @Override
+        public boolean matchesValue(int doc) {
+          double docVal = doubleVal(doc);
+          return docVal >= l && docVal <= u;
+        }
+      };
+    }
+    else if (includeLower && !includeUpper) {
+      return new ValueSourceScorer(reader, this) {
+        @Override
+        public boolean matchesValue(int doc) {
+          double docVal = doubleVal(doc);
+          return docVal >= l && docVal < u;
+        }
+      };
+    }
+    else if (!includeLower && includeUpper) {
+      return new ValueSourceScorer(reader, this) {
+        @Override
+        public boolean matchesValue(int doc) {
+          double docVal = doubleVal(doc);
+          return docVal > l && docVal <= u;
+        }
+      };
+    }
+    else {
+      return new ValueSourceScorer(reader, this) {
+        @Override
+        public boolean matchesValue(int doc) {
+          double docVal = doubleVal(doc);
+          return docVal > l && docVal < u;
+        }
+      };
+    }
+  }
 
   @Override
   public ValueFiller getValueFiller() {

Modified: lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java
Tue Oct  1 18:36:14 2013
@@ -17,8 +17,10 @@ package org.apache.lucene.queries.functi
  * limitations under the License.
  */
 
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.queries.function.FunctionValues;
 import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.queries.function.ValueSourceScorer;
 import org.apache.lucene.util.mutable.MutableValue;
 import org.apache.lucene.util.mutable.MutableValueInt;
 
@@ -75,6 +77,40 @@ public abstract class IntDocValues exten
   public String toString(int doc) {
     return vs.description() + '=' + strVal(doc);
   }
+  
+  @Override
+  public ValueSourceScorer getRangeScorer(IndexReader reader, String lowerVal, String upperVal,
boolean includeLower, boolean includeUpper) {
+    int lower,upper;
+
+    // instead of using separate comparison functions, adjust the endpoints.
+
+    if (lowerVal==null) {
+      lower = Integer.MIN_VALUE;
+    } else {
+      lower = Integer.parseInt(lowerVal);
+      if (!includeLower && lower < Integer.MAX_VALUE) lower++;
+    }
+
+     if (upperVal==null) {
+      upper = Integer.MAX_VALUE;
+    } else {
+      upper = Integer.parseInt(upperVal);
+      if (!includeUpper && upper > Integer.MIN_VALUE) upper--;
+    }
+
+    final int ll = lower;
+    final int uu = upper;
+
+    return new ValueSourceScorer(reader, this) {
+      @Override
+      public boolean matchesValue(int doc) {
+        int val = intVal(doc);
+        // only check for deleted if it's the default value
+        // if (val==0 && reader.isDeleted(doc)) return false;
+        return val >= ll && val <= uu;
+      }
+    };
+  }
 
   @Override
   public ValueFiller getValueFiller() {

Modified: lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java
Tue Oct  1 18:36:14 2013
@@ -17,8 +17,10 @@ package org.apache.lucene.queries.functi
  * limitations under the License.
  */
 
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.queries.function.FunctionValues;
 import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.queries.function.ValueSourceScorer;
 import org.apache.lucene.util.mutable.MutableValue;
 import org.apache.lucene.util.mutable.MutableValueLong;
 
@@ -80,6 +82,44 @@ public abstract class LongDocValues exte
   public String toString(int doc) {
     return vs.description() + '=' + strVal(doc);
   }
+  
+  protected long externalToLong(String extVal) {
+    return Long.parseLong(extVal);
+  }
+  
+  @Override
+  public ValueSourceScorer getRangeScorer(IndexReader reader, String lowerVal, String upperVal,
boolean includeLower, boolean includeUpper) {
+    long lower,upper;
+
+    // instead of using separate comparison functions, adjust the endpoints.
+
+    if (lowerVal==null) {
+      lower = Long.MIN_VALUE;
+    } else {
+      lower = externalToLong(lowerVal);
+      if (!includeLower && lower < Long.MAX_VALUE) lower++;
+    }
+
+     if (upperVal==null) {
+      upper = Long.MAX_VALUE;
+    } else {
+      upper = externalToLong(upperVal);
+      if (!includeUpper && upper > Long.MIN_VALUE) upper--;
+    }
+
+    final long ll = lower;
+    final long uu = upper;
+
+    return new ValueSourceScorer(reader, this) {
+      @Override
+      public boolean matchesValue(int doc) {
+        long val = longVal(doc);
+        // only check for deleted if it's the default value
+        // if (val==0 && reader.isDeleted(doc)) return false;
+        return val >= ll && val <= uu;
+      }
+    };
+  }
 
   @Override
   public ValueFiller getValueFiller() {

Modified: lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java
Tue Oct  1 18:36:14 2013
@@ -68,64 +68,6 @@ public class DoubleFieldSource extends F
       }
 
       @Override
-      public ValueSourceScorer getRangeScorer(IndexReader reader, String lowerVal, String
upperVal, boolean includeLower, boolean includeUpper) {
-        double lower,upper;
-
-        if (lowerVal==null) {
-          lower = Double.NEGATIVE_INFINITY;
-        } else {
-          lower = Double.parseDouble(lowerVal);
-        }
-
-         if (upperVal==null) {
-          upper = Double.POSITIVE_INFINITY;
-        } else {
-          upper = Double.parseDouble(upperVal);
-        }
-
-        final double l = lower;
-        final double u = upper;
-
-
-        if (includeLower && includeUpper) {
-          return new ValueSourceScorer(reader, this) {
-            @Override
-            public boolean matchesValue(int doc) {
-              double docVal = doubleVal(doc);
-              return docVal >= l && docVal <= u;
-            }
-          };
-        }
-        else if (includeLower && !includeUpper) {
-          return new ValueSourceScorer(reader, this) {
-            @Override
-            public boolean matchesValue(int doc) {
-              double docVal = doubleVal(doc);
-              return docVal >= l && docVal < u;
-            }
-          };
-        }
-        else if (!includeLower && includeUpper) {
-          return new ValueSourceScorer(reader, this) {
-            @Override
-            public boolean matchesValue(int doc) {
-              double docVal = doubleVal(doc);
-              return docVal > l && docVal <= u;
-            }
-          };
-        }
-        else {
-          return new ValueSourceScorer(reader, this) {
-            @Override
-            public boolean matchesValue(int doc) {
-              double docVal = doubleVal(doc);
-              return docVal > l && docVal < u;
-            }
-          };
-        }
-      }
-
-      @Override
       public ValueFiller getValueFiller() {
         return new ValueFiller() {
           private final MutableValueDouble mval = new MutableValueDouble();

Modified: lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java
Tue Oct  1 18:36:14 2013
@@ -101,40 +101,6 @@ public class IntFieldSource extends Fiel
       }
 
       @Override
-      public ValueSourceScorer getRangeScorer(IndexReader reader, String lowerVal, String
upperVal, boolean includeLower, boolean includeUpper) {
-        int lower,upper;
-
-        // instead of using separate comparison functions, adjust the endpoints.
-
-        if (lowerVal==null) {
-          lower = Integer.MIN_VALUE;
-        } else {
-          lower = Integer.parseInt(lowerVal);
-          if (!includeLower && lower < Integer.MAX_VALUE) lower++;
-        }
-
-         if (upperVal==null) {
-          upper = Integer.MAX_VALUE;
-        } else {
-          upper = Integer.parseInt(upperVal);
-          if (!includeUpper && upper > Integer.MIN_VALUE) upper--;
-        }
-
-        final int ll = lower;
-        final int uu = upper;
-
-        return new ValueSourceScorer(reader, this) {
-          @Override
-          public boolean matchesValue(int doc) {
-            int val = arr.get(doc);
-            // only check for deleted if it's the default value
-            // if (val==0 && reader.isDeleted(doc)) return false;
-            return val >= ll && val <= uu;
-          }
-        };
-      }
-
-      @Override
       public ValueFiller getValueFiller() {
         return new ValueFiller() {
           private final MutableValueInt mval = new MutableValueInt();

Modified: lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java?rev=1528173&r1=1528172&r2=1528173&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java
Tue Oct  1 18:36:14 2013
@@ -91,37 +91,8 @@ public class LongFieldSource extends Fie
       }
 
       @Override
-      public ValueSourceScorer getRangeScorer(IndexReader reader, String lowerVal, String
upperVal, boolean includeLower, boolean includeUpper) {
-        long lower,upper;
-
-        // instead of using separate comparison functions, adjust the endpoints.
-
-        if (lowerVal==null) {
-          lower = Long.MIN_VALUE;
-        } else {
-          lower = externalToLong(lowerVal);
-          if (!includeLower && lower < Long.MAX_VALUE) lower++;
-        }
-
-         if (upperVal==null) {
-          upper = Long.MAX_VALUE;
-        } else {
-          upper = externalToLong(upperVal);
-          if (!includeUpper && upper > Long.MIN_VALUE) upper--;
-        }
-
-        final long ll = lower;
-        final long uu = upper;
-
-        return new ValueSourceScorer(reader, this) {
-          @Override
-          public boolean matchesValue(int doc) {
-            long val = arr.get(doc);
-            // only check for deleted if it's the default value
-            // if (val==0 && reader.isDeleted(doc)) return false;
-            return val >= ll && val <= uu;
-          }
-        };
+      protected long externalToLong(String extVal) {
+        return LongFieldSource.this.externalToLong(extVal);
       }
 
       @Override



Mime
View raw message