field
as a single byte 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 single byte values.
- * @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.
- */
- public Bytes getBytes(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 bytes 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 bytes.
- * @param parser Computes byte for string values.
- * @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.
- */
- public Bytes getBytes(AtomicReader reader, String field, ByteParser parser, boolean setDocsWithField) throws IOException;
-
- /** Checks the internal cache for an appropriate entry, and if none is
- * found, reads the terms in field
as shorts 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 shorts.
- * @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.
- */
- public Shorts getShorts (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 shorts 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 shorts.
- * @param parser Computes short for string values.
- * @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.
- */
- public Shorts getShorts (AtomicReader reader, String field, ShortParser parser, boolean setDocsWithField) throws IOException;
-
/** Checks the internal cache for an appropriate entry, and if none is
* found, reads the terms in field
as integers and returns an array
* of size reader.maxDoc()
of the value each document
diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java
index 89ab8558b1f..9b3d3a1bd4d 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java
@@ -38,7 +38,6 @@ import org.apache.lucene.index.SortedDocValues;
import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
-import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FieldCacheSanityChecker;
@@ -63,8 +62,6 @@ class FieldCacheImpl implements FieldCache {
private synchronized void init() {
caches = new HashMapnull
.
- */
- public static FieldCacheRangeFilternull
.
- */
- public static FieldCacheRangeFilternull
.
- */
- public static FieldCacheRangeFilternull
.
- */
- public static FieldCacheRangeFilterBeware that this class will accept to set negative values but in order + * to do this, it will grow the number of bits per value to 64. * *
@lucene.internal
*/ - public class GrowableWriter implements PackedInts.Mutable { - private long currentMaxValue; + private long currentMask; private PackedInts.Mutable current; private final float acceptableOverheadRatio; + /** + * @param startBitsPerValue the initial number of bits per value, may grow depending on the data + * @param valueCount the number of values + * @param acceptableOverheadRatio an acceptable overhead ratio + */ public GrowableWriter(int startBitsPerValue, int valueCount, float acceptableOverheadRatio) { this.acceptableOverheadRatio = acceptableOverheadRatio; current = PackedInts.getMutable(valueCount, startBitsPerValue, this.acceptableOverheadRatio); - currentMaxValue = PackedInts.maxValue(current.getBitsPerValue()); + currentMask = mask(current.getBitsPerValue()); + } + + private static long mask(int bitsPerValue) { + return bitsPerValue == 64 ? ~0L : PackedInts.maxValue(bitsPerValue); } @Override @@ -71,16 +81,16 @@ public class GrowableWriter implements PackedInts.Mutable { } private void ensureCapacity(long value) { - assert value >= 0; - if (value <= currentMaxValue) { + if ((value & currentMask) == value) { return; } - final int bitsRequired = PackedInts.bitsRequired(value); + final int bitsRequired = value < 0 ? 64 : PackedInts.bitsRequired(value); + assert bitsRequired > current.getBitsPerValue(); final int valueCount = size(); PackedInts.Mutable next = PackedInts.getMutable(valueCount, bitsRequired, acceptableOverheadRatio); PackedInts.copy(current, 0, next, 0, valueCount, PackedInts.DEFAULT_BUFFER_SIZE); current = next; - currentMaxValue = PackedInts.maxValue(current.getBitsPerValue()); + currentMask = mask(current.getBitsPerValue()); } @Override @@ -110,6 +120,10 @@ public class GrowableWriter implements PackedInts.Mutable { public int set(int index, long[] arr, int off, int len) { long max = 0; for (int i = off, end = off + len; i < end; ++i) { + // bitwise or is nice because either all values are positive and the + // or-ed result will require as many bits per value as the max of the + // values, or one of them is negative and the result will be negative, + // forcing GrowableWriter to use 64 bits per value max |= arr[i]; } ensureCapacity(max); diff --git a/lucene/core/src/test/org/apache/lucene/TestSearch.java b/lucene/core/src/test/org/apache/lucene/TestSearch.java index e4be172b73f..f2bedd4b40d 100644 --- a/lucene/core/src/test/org/apache/lucene/TestSearch.java +++ b/lucene/core/src/test/org/apache/lucene/TestSearch.java @@ -127,7 +127,7 @@ public class TestSearch extends LuceneTestCase { for (int j = 0; j < docs.length; j++) { Document d = new Document(); d.add(newTextField("contents", docs[j], Field.Store.YES)); - d.add(newStringField("id", ""+j, Field.Store.NO)); + d.add(new IntField("id", j, Field.Store.NO)); writer.addDocument(d); } writer.close(); diff --git a/lucene/core/src/test/org/apache/lucene/TestSearchForDuplicates.java b/lucene/core/src/test/org/apache/lucene/TestSearchForDuplicates.java index fd20985de5f..3d942dc3ba4 100644 --- a/lucene/core/src/test/org/apache/lucene/TestSearchForDuplicates.java +++ b/lucene/core/src/test/org/apache/lucene/TestSearchForDuplicates.java @@ -81,7 +81,7 @@ public class TestSearchForDuplicates extends LuceneTestCase { for (int j = 0; j < MAX_DOCS; j++) { Document d = new Document(); d.add(newTextField(PRIORITY_FIELD, HIGH_PRIORITY, Field.Store.YES)); - d.add(newTextField(ID_FIELD, Integer.toString(j), Field.Store.YES)); + d.add(new IntField(ID_FIELD, j, Field.Store.YES)); writer.addDocument(d); } writer.close(); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java b/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java index 0ed240e57a8..102b7c9d7aa 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java @@ -33,6 +33,7 @@ import org.apache.lucene.codecs.lucene41.Lucene41PostingsFormat; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; +import org.apache.lucene.document.IntField; import org.apache.lucene.document.StoredField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; @@ -764,7 +765,7 @@ public void testFilesOpenClose() throws IOException { setMergePolicy(newLogMergePolicy(10)) ); Document doc = new Document(); - doc.add(newStringField("number", "17", Field.Store.NO)); + doc.add(new IntField("number", 17, Field.Store.NO)); writer.addDocument(doc); writer.commit(); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java b/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java index ff34c225836..17ce72b7c95 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java @@ -87,23 +87,17 @@ public class TestDocValuesWithThreads extends LuceneTestCase { BytesRef scratch2 = new BytesRef(); for(int iter=0;itergetInts()
- * and makes those values available as other numeric types, casting as needed. *
- *
- *
- */
-
-public class ByteFieldSource extends FieldCacheSource {
-
- private final FieldCache.ByteParser parser;
-
- public ByteFieldSource(String field) {
- this(field, null);
- }
-
- public ByteFieldSource(String field, FieldCache.ByteParser parser) {
- super(field);
- this.parser = parser;
- }
-
- @Override
- public String description() {
- return "byte(" + field + ')';
- }
-
- @Override
- public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
- final FieldCache.Bytes arr = cache.getBytes(readerContext.reader(), field, parser, false);
-
- return new FunctionValues() {
- @Override
- public byte byteVal(int doc) {
- return arr.get(doc);
- }
-
- @Override
- public short shortVal(int doc) {
- return (short) arr.get(doc);
- }
-
- @Override
- public float floatVal(int doc) {
- return (float) arr.get(doc);
- }
-
- @Override
- public int intVal(int doc) {
- return (int) arr.get(doc);
- }
-
- @Override
- public long longVal(int doc) {
- return (long) arr.get(doc);
- }
-
- @Override
- public double doubleVal(int doc) {
- return (double) arr.get(doc);
- }
-
- @Override
- public String strVal(int doc) {
- return Byte.toString(arr.get(doc));
- }
-
- @Override
- public String toString(int doc) {
- return description() + '=' + byteVal(doc);
- }
-
- @Override
- public Object objectVal(int doc) {
- return arr.get(doc); // TODO: valid?
- }
-
- };
- }
-
- @Override
- public boolean equals(Object o) {
- if (o.getClass() != ByteFieldSource.class) return false;
- ByteFieldSource
- other = (ByteFieldSource) o;
- return super.equals(other)
- && (this.parser == null ? other.parser == null :
- this.parser.getClass() == other.parser.getClass());
- }
-
- @Override
- public int hashCode() {
- int h = parser == null ? Byte.class.hashCode() : parser.getClass().hashCode();
- h += super.hashCode();
- return h;
- }
-}
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ShortFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ShortFieldSource.java
deleted file mode 100644
index 2909ebbee69..00000000000
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ShortFieldSource.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.apache.lucene.queries.function.valuesource;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.lucene.index.AtomicReaderContext;
-import org.apache.lucene.queries.function.FunctionValues;
-import org.apache.lucene.search.FieldCache;
-
-
-/**
- * Obtains short field values from the {@link org.apache.lucene.search.FieldCache}
- * using getShorts()
- * and makes those values available as other numeric types, casting as needed.
- **/
-public class ShortFieldSource extends FieldCacheSource {
-
- final FieldCache.ShortParser parser;
-
- public ShortFieldSource(String field) {
- this(field, null);
- }
-
- public ShortFieldSource(String field, FieldCache.ShortParser parser) {
- super(field);
- this.parser = parser;
- }
-
- @Override
- public String description() {
- return "short(" + field + ')';
- }
-
- @Override
- public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
- final FieldCache.Shorts arr = cache.getShorts(readerContext.reader(), field, parser, false);
-
- return new FunctionValues() {
- @Override
- public byte byteVal(int doc) {
- return (byte) arr.get(doc);
- }
-
- @Override
- public short shortVal(int doc) {
- return arr.get(doc);
- }
-
- @Override
- public float floatVal(int doc) {
- return (float) arr.get(doc);
- }
-
- @Override
- public int intVal(int doc) {
- return (int) arr.get(doc);
- }
-
- @Override
- public long longVal(int doc) {
- return (long) arr.get(doc);
- }
-
- @Override
- public double doubleVal(int doc) {
- return (double) arr.get(doc);
- }
-
- @Override
- public String strVal(int doc) {
- return Short.toString(arr.get(doc));
- }
-
- @Override
- public String toString(int doc) {
- return description() + '=' + shortVal(doc);
- }
-
- };
- }
-
- @Override
- public boolean equals(Object o) {
- if (o.getClass() != ShortFieldSource.class) return false;
- ShortFieldSource
- other = (ShortFieldSource) o;
- return super.equals(other)
- && (this.parser == null ? other.parser == null :
- this.parser.getClass() == other.parser.getClass());
- }
-
- @Override
- public int hashCode() {
- int h = parser == null ? Short.class.hashCode() : parser.getClass().hashCode();
- h += super.hashCode();
- return h;
- }
-}
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/TestCustomScoreQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/TestCustomScoreQuery.java
index 41a903e5811..d976d805475 100755
--- a/lucene/queries/src/test/org/apache/lucene/queries/TestCustomScoreQuery.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/TestCustomScoreQuery.java
@@ -52,26 +52,6 @@ public class TestCustomScoreQuery extends FunctionTestSetup {
createIndex(true);
}
- /**
- * Test that CustomScoreQuery of Type.BYTE returns the expected scores.
- */
- @Test
- public void testCustomScoreByte() throws Exception {
- // INT field values are small enough to be parsed as byte
- doTestCustomScore(BYTE_VALUESOURCE, 1.0);
- doTestCustomScore(BYTE_VALUESOURCE, 2.0);
- }
-
- /**
- * Test that CustomScoreQuery of Type.SHORT returns the expected scores.
- */
- @Test
- public void testCustomScoreShort() throws Exception {
- // INT field values are small enough to be parsed as short
- doTestCustomScore(SHORT_VALUESOURCE, 1.0);
- doTestCustomScore(SHORT_VALUESOURCE, 3.0);
- }
-
/**
* Test that CustomScoreQuery of Type.INT returns the expected scores.
*/
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java b/lucene/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
index 416967feb25..4f3c0126458 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
@@ -1,18 +1,25 @@
package org.apache.lucene.queries.function;
+import java.io.IOException;
+
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.FloatField;
+import org.apache.lucene.document.IntField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.document.Field.Store;
import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.queries.function.valuesource.ByteFieldSource;
+import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.Terms;
+import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.queries.function.valuesource.FloatFieldSource;
import org.apache.lucene.queries.function.valuesource.IntFieldSource;
-import org.apache.lucene.queries.function.valuesource.ShortFieldSource;
+import org.apache.lucene.search.FieldCache;
import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
import org.junit.AfterClass;
@@ -53,10 +60,21 @@ public abstract class FunctionTestSetup extends LuceneTestCase {
protected static final String INT_FIELD = "iii";
protected static final String FLOAT_FIELD = "fff";
- protected ValueSource BYTE_VALUESOURCE = new ByteFieldSource(INT_FIELD);
- protected ValueSource SHORT_VALUESOURCE = new ShortFieldSource(INT_FIELD);
+ private static final FieldCache.FloatParser CUSTOM_FLOAT_PARSER = new FieldCache.FloatParser() {
+
+ @Override
+ public TermsEnum termsEnum(Terms terms) throws IOException {
+ return FieldCache.NUMERIC_UTILS_INT_PARSER.termsEnum(terms);
+ }
+
+ @Override
+ public float parseFloat(BytesRef term) {
+ return (float) FieldCache.NUMERIC_UTILS_INT_PARSER.parseInt(term);
+ }
+ };
+
protected ValueSource INT_VALUESOURCE = new IntFieldSource(INT_FIELD);
- protected ValueSource INT_AS_FLOAT_VALUESOURCE = new FloatFieldSource(INT_FIELD);
+ protected ValueSource INT_AS_FLOAT_VALUESOURCE = new FloatFieldSource(INT_FIELD, CUSTOM_FLOAT_PARSER);
protected ValueSource FLOAT_VALUESOURCE = new FloatFieldSource(FLOAT_FIELD);
private static final String DOC_TEXT_LINES[] = {
@@ -140,10 +158,10 @@ public abstract class FunctionTestSetup extends LuceneTestCase {
f = newField(TEXT_FIELD, "text of doc" + scoreAndID + textLine(i), customType2); // for regular search
d.add(f);
- f = newField(INT_FIELD, "" + scoreAndID, customType); // for function scoring
+ f = new IntField(INT_FIELD, scoreAndID, Store.YES); // for function scoring
d.add(f);
- f = newField(FLOAT_FIELD, scoreAndID + ".000", customType); // for function scoring
+ f = new FloatField(FLOAT_FIELD, scoreAndID, Store.YES); // for function scoring
d.add(f);
iw.addDocument(d);
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java
index 41d3c50cbf9..7aab17edaa7 100755
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java
@@ -19,12 +19,6 @@ package org.apache.lucene.queries.function;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.queries.function.FunctionQuery;
-import org.apache.lucene.queries.function.ValueSource;
-import org.apache.lucene.queries.function.valuesource.ByteFieldSource;
-import org.apache.lucene.queries.function.valuesource.FloatFieldSource;
-import org.apache.lucene.queries.function.valuesource.IntFieldSource;
-import org.apache.lucene.queries.function.valuesource.ShortFieldSource;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.QueryUtils;
import org.apache.lucene.search.ScoreDoc;
@@ -50,20 +44,6 @@ public class TestFieldScoreQuery extends FunctionTestSetup {
createIndex(true);
}
- /** Test that FieldScoreQuery of Type.BYTE returns docs in expected order. */
- @Test
- public void testRankByte () throws Exception {
- // INT field values are small enough to be parsed as byte
- doTestRank(BYTE_VALUESOURCE);
- }
-
- /** Test that FieldScoreQuery of Type.SHORT returns docs in expected order. */
- @Test
- public void testRankShort () throws Exception {
- // INT field values are small enough to be parsed as short
- doTestRank(SHORT_VALUESOURCE);
- }
-
/** Test that FieldScoreQuery of Type.INT returns docs in expected order. */
@Test
public void testRankInt () throws Exception {
@@ -99,20 +79,6 @@ public class TestFieldScoreQuery extends FunctionTestSetup {
r.close();
}
- /** Test that FieldScoreQuery of Type.BYTE returns the expected scores. */
- @Test
- public void testExactScoreByte () throws Exception {
- // INT field values are small enough to be parsed as byte
- doTestExactScore(BYTE_VALUESOURCE);
- }
-
- /** Test that FieldScoreQuery of Type.SHORT returns the expected scores. */
- @Test
- public void testExactScoreShort () throws Exception {
- // INT field values are small enough to be parsed as short
- doTestExactScore(SHORT_VALUESOURCE);
- }
-
/** Test that FieldScoreQuery of Type.INT returns the expected scores. */
@Test
public void testExactScoreInt () throws Exception {
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java
index 572188f1920..760aab340d0 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java
@@ -18,9 +18,10 @@ package org.apache.lucene.queries.function;
*/
import java.io.IOException;
+
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.IntField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
@@ -46,13 +47,13 @@ public class TestFunctionQuerySort extends LuceneTestCase {
RandomIndexWriter writer = new RandomIndexWriter(random(), dir, iwc);
Document doc = new Document();
- Field field = new StringField("value", "", Field.Store.YES);
+ Field field = new IntField("value", 0, Field.Store.YES);
doc.add(field);
// Save docs unsorted (decreasing value n, n-1, ...)
final int NUM_VALS = 5;
for (int val = NUM_VALS; val > 0; val--) {
- field.setStringValue(Integer.toString(val));
+ field.setIntValue(val);
writer.addDocument(doc);
}
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
index cd856d3639d..e781b22b419 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
@@ -22,13 +22,16 @@ import java.util.List;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
+import org.apache.lucene.document.DoubleField;
import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FloatField;
+import org.apache.lucene.document.IntField;
+import org.apache.lucene.document.LongField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
-import org.apache.lucene.queries.function.valuesource.ByteFieldSource;
import org.apache.lucene.queries.function.valuesource.BytesRefFieldSource;
import org.apache.lucene.queries.function.valuesource.ConstValueSource;
import org.apache.lucene.queries.function.valuesource.DivFloatFunction;
@@ -54,7 +57,6 @@ import org.apache.lucene.queries.function.valuesource.QueryValueSource;
import org.apache.lucene.queries.function.valuesource.RangeMapFloatFunction;
import org.apache.lucene.queries.function.valuesource.ReciprocalFloatFunction;
import org.apache.lucene.queries.function.valuesource.ScaleFloatFunction;
-import org.apache.lucene.queries.function.valuesource.ShortFieldSource;
import org.apache.lucene.queries.function.valuesource.SumFloatFunction;
import org.apache.lucene.queries.function.valuesource.SumTotalTermFreqValueSource;
import org.apache.lucene.queries.function.valuesource.TFValueSource;
@@ -85,9 +87,9 @@ public class TestValueSources extends LuceneTestCase {
static IndexSearcher searcher;
static final List- * Field values will sort numerically, but Range Queries (and other features - * that rely on numeric ranges) will not work as expected: values will be - * evaluated in unicode String order, not numeric order. - *
- * - *- * Field values will sort numerically, but Range Queries (and other features - * that rely on numeric ranges) will not work as expected: values will be - * evaluated in unicode String order, not numeric order. - *
- * - *