You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2017/07/20 00:51:59 UTC
lucene-solr:master: SOLR-11123: Randomize PointFields in test classes
that had usage of Trie field classes/names hardcoded
Repository: lucene-solr
Updated Branches:
refs/heads/master e7d0063dc -> 9e5eaca21
SOLR-11123: Randomize PointFields in test classes that had usage of Trie field classes/names hardcoded
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9e5eaca2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9e5eaca2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9e5eaca2
Branch: refs/heads/master
Commit: 9e5eaca217ca0ced3a1463ca773ad87c844fc767
Parents: e7d0063
Author: Chris Hostetter <ho...@apache.org>
Authored: Wed Jul 19 17:51:49 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Wed Jul 19 17:51:49 2017 -0700
----------------------------------------------------------------------
solr/CHANGES.txt | 1 +
.../conf/schema-field-sort-values.xml | 6 +-
.../core/src/test/org/apache/solr/TestTrie.java | 3 +-
.../solr/cloud/DocValuesNotIndexedTest.java | 7 +-
.../TestStressCloudBlindAtomicUpdates.java | 2 +-
.../solr/schema/ChangedSchemaMergeTest.java | 8 +-
.../org/apache/solr/schema/DateFieldTest.java | 3 +-
.../solr/schema/PrimitiveFieldTypeTest.java | 151 +++++++------------
.../TestCloudManagedSchemaConcurrent.java | 4 +-
.../schema/TestSchemalessBufferedUpdates.java | 1 -
.../org/apache/solr/schema/WrappedIntField.java | 45 ------
.../solr/schema/WrappedIntPointField.java | 46 ++++++
.../apache/solr/schema/WrappedTrieIntField.java | 29 ++++
.../apache/solr/search/TestFieldSortValues.java | 3 +
.../update/processor/AtomicUpdatesTest.java | 2 -
15 files changed, 152 insertions(+), 159 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c5813a2..6dc713b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -521,6 +521,7 @@ Other Changes
- SOLR-11074: Randomize PointFields in cloud-dynamic configset and all related tests (Anshum Gupta)
- SOLR-11121: Randomize PointFields in schema-trie.xml and TestTrie (hossman)
- SOLR-11120: Remove trie fieldTypes from schema-points.xml (hossman)
+ - SOLR-11123: Randomize PointFields in test classes that had usage of Trie field classes/names hardcoded (hossman)
* SOLR-6807: Changed requestDispatcher's handleSelect to default to false, thus ignoring "qt".
Simplified configs to not refer to handleSelect or "qt". Switch all tests that assumed true to assume false
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test-files/solr/collection1/conf/schema-field-sort-values.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-field-sort-values.xml b/solr/core/src/test-files/solr/collection1/conf/schema-field-sort-values.xml
index 3a9cd3b..e6428af 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-field-sort-values.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-field-sort-values.xml
@@ -17,7 +17,6 @@
-->
<schema name="test-custom-comparator" version="1.6">
- <fieldType name="int" class="${solr.tests.IntegerFieldType}" docValues="${solr.tests.numeric.dv}" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="long" class="${solr.tests.LongFieldType}" docValues="${solr.tests.numeric.dv}" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="text" class="solr.TextField">
@@ -25,11 +24,12 @@
<tokenizer class="solr.StandardTokenizerFactory"/>
</analyzer>
</fieldType>
- <fieldType class="org.apache.solr.schema.WrappedIntField" name="wrapped_int"/>
+ <fieldType class="org.apache.solr.schema.WrappedTrieIntField" name="wrapped_trie_int" docValues="${solr.tests.numeric.dv}" />
+ <fieldType class="org.apache.solr.schema.WrappedIntPointField" name="wrapped_point_int" docValues="${solr.tests.numeric.dv}" />
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="false"/>
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
<field name="text" type="text" indexed="true" stored="false"/>
- <field name="payload" type="wrapped_int" indexed="false"
+ <field name="payload" type="${solr.tests.payload.fieldtype}" indexed="false"
stored="true" multiValued="false" docValues="true" required="true"/>
<uniqueKey>id</uniqueKey>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/TestTrie.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/TestTrie.java b/solr/core/src/test/org/apache/solr/TestTrie.java
index e7c2a33..991dbfa 100644
--- a/solr/core/src/test/org/apache/solr/TestTrie.java
+++ b/solr/core/src/test/org/apache/solr/TestTrie.java
@@ -29,7 +29,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
/**
- * Tests for TrieField functionality
+ * Tests for numeric field functionality. The name originated from {@link TrieField}, but all tests
+ * done in this class are also valid for any numeric field types.
*
*
* @since solr 1.4
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java b/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java
index be9f9a3..3f0fa47 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java
@@ -23,6 +23,7 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
@@ -132,11 +133,11 @@ public class DocValuesNotIndexedTest extends SolrCloudTestCase {
fieldsToTestMulti.size() + fieldsToTestGroupSortFirst.size() + fieldsToTestGroupSortLast.size() +
4);
- updateList.add(getType("name", "float", "class", "solr.TrieFloatField", "precisionStep", "0"));
+ updateList.add(getType("name", "float", "class", RANDOMIZED_NUMERIC_FIELDTYPES.get(Float.class)));
- updateList.add(getType("name", "double", "class", "solr.TrieDoubleField", "precisionStep", "0"));
+ updateList.add(getType("name", "double", "class", RANDOMIZED_NUMERIC_FIELDTYPES.get(Double.class)));
- updateList.add(getType("name", "date", "class", "solr.TrieDateField", "precisionStep", "0"));
+ updateList.add(getType("name", "date", "class", RANDOMIZED_NUMERIC_FIELDTYPES.get(Date.class)));
updateList.add(getType("name", "boolean", "class", "solr.BoolField"));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
index 7e0a66d..8f917d2 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
@@ -141,7 +141,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
// sanity check no one broke the assumptions we make about our schema
checkExpectedSchemaType( map("name","long",
- "class", usingPoints ? "solr.LongPointField" : "solr.TrieLongField",
+ "class", RANDOMIZED_NUMERIC_FIELDTYPES.get(Long.class),
"multiValued",Boolean.FALSE,
"indexed",Boolean.FALSE,
"stored",Boolean.FALSE,
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java b/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java
index d56382e..6cffc4f 100644
--- a/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java
@@ -163,7 +163,7 @@ public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
assertNotNull(actual.getSimilarity());
}
- private static String withWhich = "<schema name=\"tiny\" version=\"1.1\">\n" +
+ private String withWhich = "<schema name=\"tiny\" version=\"1.1\">\n" +
" <field name=\"id\" type=\"string\" indexed=\"true\" stored=\"true\" required=\"true\"/>\n" +
" <field name=\"text\" type=\"text\" indexed=\"true\" stored=\"true\"/>\n" +
" <field name=\"which\" type=\"int\" indexed=\"true\" stored=\"true\"/>\n" +
@@ -177,11 +177,11 @@ public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
" </fieldtype>\n" +
" <fieldType name=\"string\" class=\"solr.StrField\"/>\n" +
- " <fieldType name=\"int\" class=\"solr.TrieIntField\" precisionStep=\"0\" positionIncrementGap=\"0\"/>" +
+ " <fieldType name=\"int\" class=\""+RANDOMIZED_NUMERIC_FIELDTYPES.get(Integer.class)+"\" precisionStep=\"0\" positionIncrementGap=\"0\"/>" +
" <similarity class=\"${solr.test.simfac1}\"/> " +
"</schema>";
- private static String withoutWhich = "<schema name=\"tiny\" version=\"1.1\">\n" +
+ private String withoutWhich = "<schema name=\"tiny\" version=\"1.1\">\n" +
" <field name=\"id\" type=\"string\" indexed=\"true\" stored=\"true\" required=\"true\"/>\n" +
" <field name=\"text\" type=\"text\" indexed=\"true\" stored=\"true\"/>\n" +
" <uniqueKey>id</uniqueKey>\n" +
@@ -193,7 +193,7 @@ public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
" </analyzer>\n" +
" </fieldtype>\n" +
" <fieldType name=\"string\" class=\"solr.StrField\"/>\n" +
- " <fieldType name=\"int\" class=\"solr.TrieIntField\" precisionStep=\"0\" positionIncrementGap=\"0\"/>" +
+ " <fieldType name=\"int\" class=\""+RANDOMIZED_NUMERIC_FIELDTYPES.get(Integer.class)+"\" precisionStep=\"0\" positionIncrementGap=\"0\"/>" +
" <similarity class=\"${solr.test.simfac2}\"/> " +
"</schema>";
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java b/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
index d42d6dd..3ab1eb9 100644
--- a/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
@@ -40,7 +40,8 @@ public class DateFieldTest extends SolrTestCaseJ4 {
SolrConfig config = new SolrConfig
(new SolrResourceLoader(Paths.get(testInstanceDir)), testConfHome + "solrconfig.xml", null);
IndexSchema schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema.xml", config);
- f = random().nextBoolean()? new TrieDateField() : new DatePointField();
+ f = Boolean.getBoolean(NUMERIC_POINTS_SYSPROP)
+ ? new DatePointField() : new TrieDateField();
f.init(schema, Collections.<String,String>emptyMap());
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java b/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
index 897af92..013ff0e 100644
--- a/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
@@ -17,7 +17,9 @@
package org.apache.solr.schema;
import java.io.File;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.solr.SolrTestCaseJ4;
@@ -56,117 +58,74 @@ public class PrimitiveFieldTypeTest extends SolrTestCaseJ4 {
@SuppressWarnings("deprecation")
@Test
public void testDefaultOmitNorms() throws Exception {
- BinaryField bin;
- TextField t;
- TrieDateField dt;
- StrField s;
- TrieIntField ti;
- TrieLongField tl;
- TrieFloatField tf;
- TrieDoubleField td;
- BoolField b;
+ final List<Class<? extends FieldType>> types
+ = Arrays.asList(TrieDateField.class, DatePointField.class,
+ TrieIntField.class, IntPointField.class,
+ TrieLongField.class, IntPointField.class,
+ TrieFloatField.class, FloatPointField.class,
+ TrieDoubleField.class, DoublePointField.class,
+ StrField.class, BoolField.class,
+ // Non-prims, omitNorms always defaults to false regardless of schema version...
+ TextField.class, BinaryField.class);
// ***********************
// With schema version 1.4:
// ***********************
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema12.xml", config);
-
- dt = new TrieDateField();
- dt.init(schema, initMap);
- assertFalse(dt.hasProperty(FieldType.OMIT_NORMS));
-
- s = new StrField();
- s.init(schema, initMap);
- assertFalse(s.hasProperty(FieldType.OMIT_NORMS));
-
- ti = new TrieIntField();
- ti.init(schema, initMap);
- assertFalse(ti.hasProperty(FieldType.OMIT_NORMS));
-
- tl = new TrieLongField();
- tl.init(schema, initMap);
- assertFalse(tl.hasProperty(FieldType.OMIT_NORMS));
-
- tf = new TrieFloatField();
- tf.init(schema, initMap);
- assertFalse(tf.hasProperty(FieldType.OMIT_NORMS));
- td = new TrieDoubleField();
- td.init(schema, initMap);
- assertFalse(td.hasProperty(FieldType.OMIT_NORMS));
-
- b = new BoolField();
- b.init(schema, initMap);
- assertFalse(b.hasProperty(FieldType.OMIT_NORMS));
-
- // Non-primitive fields
- t = new TextField();
- t.init(schema, initMap);
- assertFalse(t.hasProperty(FieldType.OMIT_NORMS));
-
- bin = new BinaryField();
- bin.init(schema, initMap);
- assertFalse(bin.hasProperty(FieldType.OMIT_NORMS));
+ for (Class<? extends FieldType> clazz : types) {
+ FieldType ft = clazz.newInstance();
+ ft.init(schema, initMap);
+ assertFalse(ft.getClass().getName(), ft.hasProperty(FieldType.OMIT_NORMS));
+ }
+
// ***********************
// With schema version 1.5
// ***********************
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema15.xml", config);
- dt = new TrieDateField();
- dt.init(schema, initMap);
- assertTrue(dt.hasProperty(FieldType.OMIT_NORMS));
-
- s = new StrField();
- s.init(schema, initMap);
- assertTrue(s.hasProperty(FieldType.OMIT_NORMS));
-
- ti = new TrieIntField();
- ti.init(schema, initMap);
- assertTrue(ti.hasProperty(FieldType.OMIT_NORMS));
-
- tl = new TrieLongField();
- tl.init(schema, initMap);
- assertTrue(tl.hasProperty(FieldType.OMIT_NORMS));
-
- tf = new TrieFloatField();
- tf.init(schema, initMap);
- assertTrue(tf.hasProperty(FieldType.OMIT_NORMS));
-
- td = new TrieDoubleField();
- td.init(schema, initMap);
- assertTrue(td.hasProperty(FieldType.OMIT_NORMS));
-
- b = new BoolField();
- b.init(schema, initMap);
- assertTrue(b.hasProperty(FieldType.OMIT_NORMS));
-
- // Non-primitive fields
- t = new TextField();
- t.init(schema, initMap);
- assertFalse(t.hasProperty(FieldType.OMIT_NORMS));
-
- bin = new BinaryField();
- bin.init(schema, initMap);
- assertFalse(bin.hasProperty(FieldType.OMIT_NORMS));
+ for (Class<? extends FieldType> clazz : types) {
+ FieldType ft = clazz.newInstance();
+ ft.init(schema, initMap);
+ assertEquals(ft.getClass().getName(),
+ ft instanceof PrimitiveFieldType,
+ ft.hasProperty(FieldType.OMIT_NORMS));
+ }
+
}
- public void testTrieDateField() {
+ public void testDateField() {
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema15.xml", config);
- TrieDateField tdt = new TrieDateField();
- Map<String, String> args = new HashMap<>();
- args.put("sortMissingLast", "true");
- args.put("indexed", "true");
- args.put("stored", "false");
- args.put("docValues", "true");
- args.put("precisionStep", "16");
- tdt.setArgs(schema, args);
- assertTrue(tdt.hasProperty(FieldType.OMIT_NORMS));
- assertTrue(tdt.hasProperty(FieldType.SORT_MISSING_LAST));
- assertTrue(tdt.hasProperty(FieldType.INDEXED));
- assertFalse(tdt.hasProperty(FieldType.STORED));
- assertTrue(tdt.hasProperty(FieldType.DOC_VALUES));
- assertEquals(16, tdt.getPrecisionStep());
+
+ final TrieDateField tdt = new TrieDateField();
+ {
+ final Map<String, String> args = new HashMap<>();
+ args.put("sortMissingLast", "true");
+ args.put("indexed", "true");
+ args.put("stored", "false");
+ args.put("docValues", "true");
+ args.put("precisionStep", "16");
+ tdt.setArgs(schema, args);
+ assertEquals(16, tdt.getPrecisionStep());
+ }
+ final DatePointField pdt = new DatePointField();
+ {
+ final Map<String, String> args = new HashMap<>();
+ args.put("sortMissingLast", "true");
+ args.put("indexed", "true");
+ args.put("stored", "false");
+ args.put("docValues", "true");
+ pdt.setArgs(schema, args);
+ }
+
+ for (FieldType ft : Arrays.asList(tdt, pdt)) {
+ assertTrue(ft.getClass().getName(), ft.hasProperty(FieldType.OMIT_NORMS));
+ assertTrue(ft.getClass().getName(), ft.hasProperty(FieldType.SORT_MISSING_LAST));
+ assertTrue(ft.getClass().getName(), ft.hasProperty(FieldType.INDEXED));
+ assertFalse(ft.getClass().getName(), ft.hasProperty(FieldType.STORED));
+ assertTrue(ft.getClass().getName(), ft.hasProperty(FieldType.DOC_VALUES));
+ }
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java b/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
index e6e4da1..703b42b 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
@@ -149,7 +149,7 @@ public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestB
}
private static void addFieldTypePut(RestTestHarness publisher, String typeName, int updateTimeoutSecs) throws Exception {
- final String content = "{\"class\":\"solr.TrieIntField\"}";
+ final String content = "{\"class\":\""+RANDOMIZED_NUMERIC_FIELDTYPES.get(Integer.class)+"\"}";
String request = "/schema/fieldtypes/" + typeName + "?wt=xml";
if (updateTimeoutSecs > 0)
request += "&updateTimeoutSecs="+updateTimeoutSecs;
@@ -158,7 +158,7 @@ public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestB
}
private static void addFieldTypePost(RestTestHarness publisher, String typeName, int updateTimeoutSecs) throws Exception {
- final String content = "[{\"name\":\""+typeName+"\",\"class\":\"solr.TrieIntField\"}]";
+ final String content = "[{\"name\":\""+typeName+"\",\"class\":\""+RANDOMIZED_NUMERIC_FIELDTYPES.get(Integer.class)+"\"}]";
String request = "/schema/fieldtypes/?wt=xml";
if (updateTimeoutSecs > 0)
request += "&updateTimeoutSecs="+updateTimeoutSecs;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java b/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
index ca48f78..eb1031c 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
@@ -102,7 +102,6 @@ public class TestSchemalessBufferedUpdates extends SolrTestCaseJ4 {
// WARN [...] o.a.s.u.UpdateLog REYPLAY_ERR: IOException reading log
// org.apache.solr.common.SolrException: Invalid Date String:'2017-01-05'
// at org.apache.solr.util.DateMathParser.parseMath(DateMathParser.java:234)
- // at org.apache.solr.schema.TrieField.createField(TrieField.java:725) [...]
updateJ(jsonAdd(processAdd(sdoc("id","2", "f_dt","2017-01-05"))), params(DISTRIB_UPDATE_PARAM,FROM_LEADER));
Future<UpdateLog.RecoveryInfo> rinfoFuture = ulog.applyBufferedUpdates();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java b/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java
deleted file mode 100644
index 458ac03..0000000
--- a/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-package org.apache.solr.schema;
-
-import org.apache.lucene.expressions.Expression;
-import org.apache.lucene.expressions.SimpleBindings;
-import org.apache.lucene.expressions.js.JavascriptCompiler;
-import org.apache.lucene.search.SortField;
-
-/**
- * Custom field wrapping an int, to test sorting via a custom comparator.
- */
-public class WrappedIntField extends TrieIntField {
- Expression expr;
-
- public WrappedIntField() {
- try {
- expr = JavascriptCompiler.compile("payload % 3");
- } catch (Exception e) {
- throw new RuntimeException("impossible?", e);
- }
- }
-
- @Override
- public SortField getSortField(final SchemaField field, final boolean reverse) {
- field.checkSortability();
- SimpleBindings bindings = new SimpleBindings();
- bindings.add(super.getSortField(field, reverse));
- return expr.getSortField(bindings, reverse);
- }
-}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java b/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java
new file mode 100644
index 0000000..c483e8c
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+package org.apache.solr.schema;
+
+import org.apache.lucene.expressions.Expression;
+import org.apache.lucene.expressions.SimpleBindings;
+import org.apache.lucene.expressions.js.JavascriptCompiler;
+import org.apache.lucene.search.SortField;
+
+/**
+ * Custom field wrapping an int, to test sorting via a custom comparator.
+ */
+public class WrappedIntPointField extends IntPointField {
+ /** static helper for re-use in sibling trie class */
+ public static SortField getSortField(final SortField superSort, final SchemaField field) {
+ field.checkSortability();
+ Expression expr = null;
+ try {
+ expr = JavascriptCompiler.compile(field.getName() + " % 3");
+ } catch (Exception e) {
+ throw new RuntimeException("impossible?", e);
+ }
+ SimpleBindings bindings = new SimpleBindings();
+ bindings.add(superSort);
+ return expr.getSortField(bindings, superSort.getReverse());
+ }
+
+ @Override
+ public SortField getSortField(final SchemaField field, final boolean reverse) {
+ return getSortField(super.getSortField(field, reverse), field);
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java b/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java
new file mode 100644
index 0000000..daee484
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.apache.solr.schema;
+
+import org.apache.lucene.search.SortField;
+
+/**
+ * Custom field wrapping an int, to test sorting via a custom comparator.
+ */
+public class WrappedTrieIntField extends TrieIntField {
+ @Override
+ public SortField getSortField(final SchemaField field, final boolean reverse) {
+ return WrappedIntPointField.getSortField(super.getSortField(field, reverse), field);
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java b/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
index 3e07bf3..fcd9ee5 100644
--- a/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
+++ b/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
@@ -27,6 +27,9 @@ public class TestFieldSortValues extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
+ System.setProperty("solr.tests.payload.fieldtype",
+ Boolean.getBoolean(NUMERIC_POINTS_SYSPROP) ?
+ "wrapped_point_int" : "wrapped_trie_int");
initCore("solrconfig-minimal.xml", "schema-field-sort-values.xml");
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e5eaca2/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
index 19780df..fefbe5d 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
@@ -24,7 +24,6 @@ import java.util.List;
import com.google.common.collect.ImmutableMap;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.schema.TrieDateField;
import org.apache.solr.util.DateMathParser;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -615,7 +614,6 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {
doc = new SolrInputDocument();
doc.setField("id", "10001");
- TrieDateField trieDF = new TrieDateField();
Date tempDate = DateMathParser.parseMath(null, "2014-02-01T12:00:00Z");
doc.setField("dateRemove", new Date[]{DateMathParser.parseMath(null, "2014-02-01T12:00:00Z"),
DateMathParser.parseMath(null, "2014-07-02T12:00:00Z"),