You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2016/03/08 17:36:42 UTC

lucene-solr git commit: LUCENE-7075: clean up LegacyNumerics* usage in queries/ tests

Repository: lucene-solr
Updated Branches:
  refs/heads/master 75f18ad40 -> f9fbf8bc1


LUCENE-7075: clean up LegacyNumerics* usage in queries/ tests


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f9fbf8bc
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f9fbf8bc
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f9fbf8bc

Branch: refs/heads/master
Commit: f9fbf8bc1d6fa7667d260ed48428ffefc8fc3c5d
Parents: 75f18ad
Author: Robert Muir <rm...@apache.org>
Authored: Tue Mar 8 11:17:12 2016 -0500
Committer: Robert Muir <rm...@apache.org>
Committed: Tue Mar 8 11:17:12 2016 -0500

----------------------------------------------------------------------
 .../lucene/queries/function/FunctionTestSetup.java  |  8 +++-----
 .../queries/function/TestFunctionQuerySort.java     |  4 ++--
 .../lucene/queries/function/TestValueSources.java   | 16 ----------------
 3 files changed, 5 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f9fbf8bc/lucene/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
----------------------------------------------------------------------
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 d5a587d..2764a8f 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
@@ -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)));
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f9fbf8bc/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java
----------------------------------------------------------------------
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 b9e1eb2..67f67b2 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
@@ -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);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f9fbf8bc/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
----------------------------------------------------------------------
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 37a32da..509e0ab 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
@@ -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]));