diff --git a/lucene/build.xml b/lucene/build.xml index b2412ea4dfd..3236338dcac 100644 --- a/lucene/build.xml +++ b/lucene/build.xml @@ -253,7 +253,7 @@ - + diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionValues.java index c1890f42d56..9b529fd01f0 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionValues.java @@ -87,7 +87,14 @@ public abstract class FunctionValues { public int numOrd() { throw new UnsupportedOperationException(); } public abstract String toString(int doc); - /** @lucene.experimental */ + /** + * Abstraction of the logic required to fill the value of a specified doc into + * a reusable {@link MutableValue}. Implementations of {@link FunctionValues} + * are encouraged to define their own implementations of ValueFiller if their + * value is not a float. + * + * @lucene.experimental + */ public static abstract class ValueFiller { /** MutableValue will be reused across calls */ public abstract MutableValue getValue(); diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java b/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java index 677ecfb65d3..6976a577dd8 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java @@ -24,6 +24,10 @@ import org.apache.lucene.util.Bits; import java.io.IOException; +/** + * {@link Scorer} which returns the result of {@link FunctionValues#floatVal(int)} as + * the score for a document. + */ public class ValueSourceScorer extends Scorer { protected final IndexReader reader; private int doc = -1; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/BoolDocValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/BoolDocValues.java index b942e8ae016..09e9e94ec70 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/BoolDocValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/BoolDocValues.java @@ -22,7 +22,10 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.util.mutable.MutableValue; import org.apache.lucene.util.mutable.MutableValueBool; - +/** + * Abstract {@link FunctionValues} implementation which supports retrieving boolean values. + * Implementations can control how the boolean values are loaded through {@link #boolVal(int)}} + */ public abstract class BoolDocValues extends FunctionValues { protected final ValueSource vs; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DocTermsIndexDocValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DocTermsIndexDocValues.java index 89ffd1929e3..6c0da33518b 100755 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DocTermsIndexDocValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DocTermsIndexDocValues.java @@ -155,6 +155,9 @@ public abstract class DocTermsIndexDocValues extends FunctionValues { }; } + /** + * Custom Exception to be thrown when the DocTermsIndex for a field cannot be generated + */ public static final class DocTermsIndexException extends RuntimeException { public DocTermsIndexException(final String fieldName, final RuntimeException cause) { diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java index 44cc440ae74..2aae6fef520 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/DoubleDocValues.java @@ -22,6 +22,10 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.util.mutable.MutableValue; import org.apache.lucene.util.mutable.MutableValueDouble; +/** + * Abstract {@link FunctionValues} implementation which supports retrieving double values. + * Implementations can control how the double values are loaded through {@link #doubleVal(int)}} + */ public abstract class DoubleDocValues extends FunctionValues { protected final ValueSource vs; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/FloatDocValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/FloatDocValues.java index 231c2649493..5e975a740df 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/FloatDocValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/FloatDocValues.java @@ -22,6 +22,10 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.util.mutable.MutableValue; import org.apache.lucene.util.mutable.MutableValueFloat; +/** + * Abstract {@link FunctionValues} implementation which supports retrieving float values. + * Implementations can control how the float values are loaded through {@link #floatVal(int)}} + */ public abstract class FloatDocValues extends FunctionValues { protected final ValueSource vs; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java index 7276afcd240..68179232720 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/IntDocValues.java @@ -22,7 +22,10 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.util.mutable.MutableValue; import org.apache.lucene.util.mutable.MutableValueInt; - +/** + * Abstract {@link FunctionValues} implementation which supports retrieving int values. + * Implementations can control how the int values are loaded through {@link #intVal(int)} + */ public abstract class IntDocValues extends FunctionValues { protected final ValueSource vs; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java index 26e4fde941b..885014aad86 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/LongDocValues.java @@ -22,7 +22,10 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.util.mutable.MutableValue; import org.apache.lucene.util.mutable.MutableValueLong; - +/** + * Abstract {@link FunctionValues} implementation which supports retrieving long values. + * Implementations can control how the long values are loaded through {@link #longVal(int)}} + */ public abstract class LongDocValues extends FunctionValues { protected final ValueSource vs; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/StrDocValues.java b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/StrDocValues.java index 726c5667bbc..ad2e5bc530b 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/StrDocValues.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/docvalues/StrDocValues.java @@ -22,6 +22,10 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.util.mutable.MutableValue; import org.apache.lucene.util.mutable.MutableValueStr; +/** + * Abstract {@link FunctionValues} implementation which supports retrieving String values. + * Implementations can control how the String values are loaded through {@link #strVal(int)}} + */ public abstract class StrDocValues extends FunctionValues { protected final ValueSource vs; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BoolFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BoolFunction.java index 643068650f8..57c3a6c594d 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BoolFunction.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BoolFunction.java @@ -19,7 +19,10 @@ package org.apache.lucene.queries.function.valuesource; import org.apache.lucene.queries.function.ValueSource; - +/** + * Abstract parent class for those {@link ValueSource} implementations which + * apply boolean logic to their values + */ public abstract class BoolFunction extends ValueSource { // TODO: placeholder to return type, among other common future functionality } diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java index b0258917099..c94782409bb 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java @@ -27,6 +27,12 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +/** + * {@link ValueSource} implementation which only returns the values from the provided + * ValueSources which are available for a particular docId. Consequently, when combined + * with a {@link ConstValueSource}, this function serves as a way to return a default + * value when the values for a field are unavailable. + */ public class DefFunction extends MultiFunction { public DefFunction(List sources) { super(sources); diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java index b384918fd77..241dfa03b97 100755 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java @@ -26,6 +26,10 @@ import org.apache.lucene.search.IndexSearcher; import java.io.IOException; import java.util.Map; +/** + * Abstract {@link ValueSource} implementation which wraps two ValueSources + * and applies an extendible float function to their values. + **/ public abstract class DualFloatFunction extends ValueSource { protected final ValueSource a; protected final ValueSource b; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java index 28b6cd284da..0075aa4e477 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java @@ -27,7 +27,10 @@ import java.io.IOException; import java.util.List; import java.util.Map; - +/** + * Abstract {@link ValueSource} implementation which wraps multiple ValueSources + * and applies an extendible boolean function to their values. + **/ public abstract class MultiBoolFunction extends BoolFunction { protected final List sources; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java index 1131d21c798..d23c209cac4 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java @@ -28,9 +28,9 @@ import java.io.IOException; /** - * - * - **/ // a simple function of multiple sources + * Abstract {@link ValueSource} implementation which wraps multiple ValueSources + * and applies an extendible float function to their values. + **/ public abstract class MultiFloatFunction extends ValueSource { protected final ValueSource[] sources; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java index e6cdfae5ba6..d3272a72d21 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java @@ -27,7 +27,10 @@ import java.util.Arrays; import java.util.List; import java.util.Map; - +/** + * Abstract parent class for {@link ValueSource} implementations that wrap multiple + * ValueSources and apply their own logic. + */ public abstract class MultiFunction extends ValueSource { protected final List sources; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java index fe4757aeeb5..d29aeff79d7 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java @@ -26,7 +26,13 @@ import org.apache.lucene.search.IndexSearcher; import java.io.IOException; import java.util.Map; - +/** + * {@link BoolFunction} implementation which applies an extendible boolean + * function to the values of a single wrapped {@link ValueSource}. + * + * Functions this can be used for include whether a field has a value or not, + * or inverting the boolean value of the wrapped ValueSource. + */ public abstract class SimpleBoolFunction extends BoolFunction { protected final ValueSource source;