mirror of https://github.com/apache/lucene.git
LUCENE-7075: clean up LegacyNumerics* usage in queries/ tests
This commit is contained in:
parent
b6ffd27bf3
commit
f297e900c0
|
@ -21,12 +21,10 @@ 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.LegacyFloatField;
|
||||
import org.apache.lucene.document.LegacyIntField;
|
||||
import org.apache.lucene.document.NumericDocValuesField;
|
||||
import org.apache.lucene.document.SortedDocValuesField;
|
||||
import org.apache.lucene.document.StoredField;
|
||||
import org.apache.lucene.document.TextField;
|
||||
import org.apache.lucene.document.Field.Store;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.index.RandomIndexWriter;
|
||||
import org.apache.lucene.queries.function.valuesource.FloatFieldSource;
|
||||
|
@ -143,11 +141,11 @@ public abstract class FunctionTestSetup extends LuceneTestCase {
|
|||
f = newField(TEXT_FIELD, "text of doc" + scoreAndID + textLine(i), customType2); // for regular search
|
||||
d.add(f);
|
||||
|
||||
f = new LegacyIntField(INT_FIELD, scoreAndID, Store.YES); // for function scoring
|
||||
f = new StoredField(INT_FIELD, scoreAndID); // for function scoring
|
||||
d.add(f);
|
||||
d.add(new NumericDocValuesField(INT_FIELD, scoreAndID));
|
||||
|
||||
f = new LegacyFloatField(FLOAT_FIELD, scoreAndID, Store.YES); // for function scoring
|
||||
f = new StoredField(FLOAT_FIELD, scoreAndID); // for function scoring
|
||||
d.add(f);
|
||||
d.add(new NumericDocValuesField(FLOAT_FIELD, Float.floatToRawIntBits(scoreAndID)));
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.LegacyIntField;
|
||||
import org.apache.lucene.document.NumericDocValuesField;
|
||||
import org.apache.lucene.document.StoredField;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.index.RandomIndexWriter;
|
||||
|
@ -102,7 +102,7 @@ public class TestFunctionQuerySort extends LuceneTestCase {
|
|||
RandomIndexWriter writer = new RandomIndexWriter(random(), dir, iwc);
|
||||
|
||||
Document doc = new Document();
|
||||
Field field = new LegacyIntField("value", 0, Field.Store.YES);
|
||||
Field field = new StoredField("value", 0);
|
||||
Field dvField = new NumericDocValuesField("value", 0);
|
||||
doc.add(field);
|
||||
doc.add(dvField);
|
||||
|
|
|
@ -24,11 +24,7 @@ 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.LegacyDoubleField;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.LegacyFloatField;
|
||||
import org.apache.lucene.document.LegacyIntField;
|
||||
import org.apache.lucene.document.LegacyLongField;
|
||||
import org.apache.lucene.document.NumericDocValuesField;
|
||||
import org.apache.lucene.document.SortedDocValuesField;
|
||||
import org.apache.lucene.document.StringField;
|
||||
|
@ -120,20 +116,12 @@ public class TestValueSources extends LuceneTestCase {
|
|||
document.add(idField);
|
||||
Field idDVField = new SortedDocValuesField("id", new BytesRef());
|
||||
document.add(idDVField);
|
||||
Field doubleField = new LegacyDoubleField("double", 0d, Field.Store.NO);
|
||||
document.add(doubleField);
|
||||
Field doubleDVField = new NumericDocValuesField("double", 0);
|
||||
document.add(doubleDVField);
|
||||
Field floatField = new LegacyFloatField("float", 0f, Field.Store.NO);
|
||||
document.add(floatField);
|
||||
Field floatDVField = new NumericDocValuesField("float", 0);
|
||||
document.add(floatDVField);
|
||||
Field intField = new LegacyIntField("int", 0, Field.Store.NO);
|
||||
document.add(intField);
|
||||
Field intDVField = new NumericDocValuesField("int", 0);
|
||||
document.add(intDVField);
|
||||
Field longField = new LegacyLongField("long", 0L, Field.Store.NO);
|
||||
document.add(longField);
|
||||
Field longDVField = new NumericDocValuesField("long", 0);
|
||||
document.add(longDVField);
|
||||
Field stringField = new StringField("string", "", Field.Store.NO);
|
||||
|
@ -146,13 +134,9 @@ public class TestValueSources extends LuceneTestCase {
|
|||
for (String [] doc : documents) {
|
||||
idField.setStringValue(doc[0]);
|
||||
idDVField.setBytesValue(new BytesRef(doc[0]));
|
||||
doubleField.setDoubleValue(Double.valueOf(doc[1]));
|
||||
doubleDVField.setLongValue(Double.doubleToRawLongBits(Double.valueOf(doc[1])));
|
||||
floatField.setFloatValue(Float.valueOf(doc[2]));
|
||||
floatDVField.setLongValue(Float.floatToRawIntBits(Float.valueOf(doc[2])));
|
||||
intField.setIntValue(Integer.valueOf(doc[3]));
|
||||
intDVField.setLongValue(Integer.valueOf(doc[3]));
|
||||
longField.setLongValue(Long.valueOf(doc[4]));
|
||||
longDVField.setLongValue(Long.valueOf(doc[4]));
|
||||
stringField.setStringValue(doc[5]);
|
||||
stringDVField.setBytesValue(new BytesRef(doc[5]));
|
||||
|
|
Loading…
Reference in New Issue