Index: lucene/core/src/java/org/apache/lucene/search/FieldCache.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/search/FieldCache.java (revision 1525194)
+++ lucene/core/src/java/org/apache/lucene/search/FieldCache.java (working copy)
@@ -25,6 +25,7 @@
import org.apache.lucene.document.FloatField; // for javadocs
import org.apache.lucene.document.IntField; // for javadocs
import org.apache.lucene.document.LongField; // for javadocs
+import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DocTermOrds;
@@ -308,37 +309,38 @@
public Floats getFloats (AtomicReader reader, String field, FloatParser parser, boolean setDocsWithField) throws IOException;
/**
- * Checks the internal cache for an appropriate entry, and if none is
- * found, reads the terms in field as longs and returns an array
- * of size reader.maxDoc() of the value each document
- * has in the given field.
+ * Returns a {@link Longs} over the values found in documents in the given
+ * field.
*
- * @param reader Used to get field values.
- * @param field Which field contains the longs.
- * @param setDocsWithField If true then {@link #getDocsWithField} will
- * also be computed and stored in the FieldCache.
- * @return The values in the given field for each document.
- * @throws java.io.IOException If any error occurs.
+ * @see #getLongs(AtomicReader, String, LongParser, boolean)
*/
- public Longs getLongs(AtomicReader reader, String field, boolean setDocsWithField)
- throws IOException;
+ public Longs getLongs(AtomicReader reader, String field, boolean setDocsWithField) throws IOException;
/**
- * Checks the internal cache for an appropriate entry, and if none is found,
- * reads the terms in field as longs and returns an array of
- * size reader.maxDoc() of the value each document has in the
- * given field.
- *
- * @param reader Used to get field values.
- * @param field Which field contains the longs.
- * @param parser Computes integer for string values.
- * @param setDocsWithField If true then {@link #getDocsWithField} will
- * also be computed and stored in the FieldCache.
+ * Returns a {@link Longs} over the values found in documents in the given
+ * field. If the field was indexed as {@link NumericDocValuesField}, it simply
+ * uses {@link AtomicReader#getNumericDocValues(String)} to read the values.
+ * Otherwise, it checks the internal cache for an appropriate entry, and if
+ * none is found, reads the terms in field as longs and returns
+ * an array of size reader.maxDoc() of the value each document
+ * has in the given field.
+ *
+ * @param reader
+ * Used to get field values.
+ * @param field
+ * Which field contains the longs.
+ * @param parser
+ * Computes long for string values. May be {@code null} if the
+ * requested field was indexed as {@link NumericDocValuesField} or
+ * {@link LongField}.
+ * @param setDocsWithField
+ * If true then {@link #getDocsWithField} will also be computed and
+ * stored in the FieldCache.
* @return The values in the given field for each document.
- * @throws IOException If any error occurs.
+ * @throws IOException
+ * If any error occurs.
*/
- public Longs getLongs(AtomicReader reader, String field, LongParser parser, boolean setDocsWithField)
- throws IOException;
+ public Longs getLongs(AtomicReader reader, String field, LongParser parser, boolean setDocsWithField) throws IOException;
/**
* Checks the internal cache for an appropriate entry, and if none is
Index: lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java (revision 1525194)
+++ lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java (working copy)
@@ -671,12 +671,12 @@
}
}
- // inherit javadocs
+ @Override
public Longs getLongs(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
return getLongs(reader, field, null, setDocsWithField);
}
- // inherit javadocs
+ @Override
public Longs getLongs(AtomicReader reader, String field, FieldCache.LongParser parser, boolean setDocsWithField)
throws IOException {
final NumericDocValues valuesIn = reader.getNumericDocValues(field);
Index: lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java
===================================================================
--- lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java (revision 1525194)
+++ lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java (working copy)
@@ -31,13 +31,9 @@
import org.apache.lucene.util.mutable.MutableValueLong;
/**
- * Obtains float field values from the {@link org.apache.lucene.search.FieldCache}
- * using getFloats()
- * and makes those values available as other numeric types, casting as needed.
- *
- *
+ * Obtains long field values from {@link FieldCache#getLongs} and makes those
+ * values available as other numeric types, casting as needed.
*/
-
public class LongFieldSource extends FieldCacheSource {
protected final FieldCache.LongParser parser;