mirror of https://github.com/apache/lucene.git
SOLR-11123: Randomize PointFields in test classes that had usage of Trie field classes/names hardcoded
This commit is contained in:
parent
e7d0063dc1
commit
9e5eaca217
|
@ -521,6 +521,7 @@ Other Changes
|
||||||
- SOLR-11074: Randomize PointFields in cloud-dynamic configset and all related tests (Anshum Gupta)
|
- 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-11121: Randomize PointFields in schema-trie.xml and TestTrie (hossman)
|
||||||
- SOLR-11120: Remove trie fieldTypes from schema-points.xml (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".
|
* 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
|
Simplified configs to not refer to handleSelect or "qt". Switch all tests that assumed true to assume false
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<schema name="test-custom-comparator" version="1.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="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="string" class="solr.StrField" sortMissingLast="true"/>
|
||||||
<fieldType name="text" class="solr.TextField">
|
<fieldType name="text" class="solr.TextField">
|
||||||
|
@ -25,11 +24,12 @@
|
||||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||||
</analyzer>
|
</analyzer>
|
||||||
</fieldType>
|
</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="id" type="string" indexed="true" stored="true" multiValued="false" required="false"/>
|
||||||
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
|
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
|
||||||
<field name="text" type="text" indexed="true" stored="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"/>
|
stored="true" multiValued="false" docValues="true" required="true"/>
|
||||||
|
|
||||||
<uniqueKey>id</uniqueKey>
|
<uniqueKey>id</uniqueKey>
|
||||||
|
|
|
@ -29,7 +29,8 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
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
|
* @since solr 1.4
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -132,11 +133,11 @@ public class DocValuesNotIndexedTest extends SolrCloudTestCase {
|
||||||
fieldsToTestMulti.size() + fieldsToTestGroupSortFirst.size() + fieldsToTestGroupSortLast.size() +
|
fieldsToTestMulti.size() + fieldsToTestGroupSortFirst.size() + fieldsToTestGroupSortLast.size() +
|
||||||
4);
|
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"));
|
updateList.add(getType("name", "boolean", "class", "solr.BoolField"));
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
|
||||||
|
|
||||||
// sanity check no one broke the assumptions we make about our schema
|
// sanity check no one broke the assumptions we make about our schema
|
||||||
checkExpectedSchemaType( map("name","long",
|
checkExpectedSchemaType( map("name","long",
|
||||||
"class", usingPoints ? "solr.LongPointField" : "solr.TrieLongField",
|
"class", RANDOMIZED_NUMERIC_FIELDTYPES.get(Long.class),
|
||||||
"multiValued",Boolean.FALSE,
|
"multiValued",Boolean.FALSE,
|
||||||
"indexed",Boolean.FALSE,
|
"indexed",Boolean.FALSE,
|
||||||
"stored",Boolean.FALSE,
|
"stored",Boolean.FALSE,
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
|
||||||
assertNotNull(actual.getSimilarity());
|
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=\"id\" type=\"string\" indexed=\"true\" stored=\"true\" required=\"true\"/>\n" +
|
||||||
" <field name=\"text\" type=\"text\" indexed=\"true\" stored=\"true\"/>\n" +
|
" <field name=\"text\" type=\"text\" indexed=\"true\" stored=\"true\"/>\n" +
|
||||||
" <field name=\"which\" type=\"int\" 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>\n" +
|
||||||
" <fieldType name=\"string\" class=\"solr.StrField\"/>\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}\"/> " +
|
" <similarity class=\"${solr.test.simfac1}\"/> " +
|
||||||
"</schema>";
|
"</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=\"id\" type=\"string\" indexed=\"true\" stored=\"true\" required=\"true\"/>\n" +
|
||||||
" <field name=\"text\" type=\"text\" indexed=\"true\" stored=\"true\"/>\n" +
|
" <field name=\"text\" type=\"text\" indexed=\"true\" stored=\"true\"/>\n" +
|
||||||
" <uniqueKey>id</uniqueKey>\n" +
|
" <uniqueKey>id</uniqueKey>\n" +
|
||||||
|
@ -193,7 +193,7 @@ public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
|
||||||
" </analyzer>\n" +
|
" </analyzer>\n" +
|
||||||
" </fieldtype>\n" +
|
" </fieldtype>\n" +
|
||||||
" <fieldType name=\"string\" class=\"solr.StrField\"/>\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}\"/> " +
|
" <similarity class=\"${solr.test.simfac2}\"/> " +
|
||||||
"</schema>";
|
"</schema>";
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ public class DateFieldTest extends SolrTestCaseJ4 {
|
||||||
SolrConfig config = new SolrConfig
|
SolrConfig config = new SolrConfig
|
||||||
(new SolrResourceLoader(Paths.get(testInstanceDir)), testConfHome + "solrconfig.xml", null);
|
(new SolrResourceLoader(Paths.get(testInstanceDir)), testConfHome + "solrconfig.xml", null);
|
||||||
IndexSchema schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema.xml", config);
|
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());
|
f.init(schema, Collections.<String,String>emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
package org.apache.solr.schema;
|
package org.apache.solr.schema;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
|
@ -56,117 +58,74 @@ public class PrimitiveFieldTypeTest extends SolrTestCaseJ4 {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultOmitNorms() throws Exception {
|
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:
|
// With schema version 1.4:
|
||||||
// ***********************
|
// ***********************
|
||||||
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema12.xml", config);
|
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema12.xml", config);
|
||||||
|
|
||||||
|
|
||||||
|
for (Class<? extends FieldType> clazz : types) {
|
||||||
|
FieldType ft = clazz.newInstance();
|
||||||
|
ft.init(schema, initMap);
|
||||||
|
assertFalse(ft.getClass().getName(), ft.hasProperty(FieldType.OMIT_NORMS));
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
// ***********************
|
// ***********************
|
||||||
// With schema version 1.5
|
// With schema version 1.5
|
||||||
// ***********************
|
// ***********************
|
||||||
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema15.xml", config);
|
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema15.xml", config);
|
||||||
|
|
||||||
dt = new TrieDateField();
|
for (Class<? extends FieldType> clazz : types) {
|
||||||
dt.init(schema, initMap);
|
FieldType ft = clazz.newInstance();
|
||||||
assertTrue(dt.hasProperty(FieldType.OMIT_NORMS));
|
ft.init(schema, initMap);
|
||||||
|
assertEquals(ft.getClass().getName(),
|
||||||
s = new StrField();
|
ft instanceof PrimitiveFieldType,
|
||||||
s.init(schema, initMap);
|
ft.hasProperty(FieldType.OMIT_NORMS));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTrieDateField() {
|
public void testDateField() {
|
||||||
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema15.xml", config);
|
schema = IndexSchemaFactory.buildIndexSchema(testConfHome + "schema15.xml", config);
|
||||||
TrieDateField tdt = new TrieDateField();
|
|
||||||
Map<String, String> args = new HashMap<>();
|
final TrieDateField tdt = new TrieDateField();
|
||||||
args.put("sortMissingLast", "true");
|
{
|
||||||
args.put("indexed", "true");
|
final Map<String, String> args = new HashMap<>();
|
||||||
args.put("stored", "false");
|
args.put("sortMissingLast", "true");
|
||||||
args.put("docValues", "true");
|
args.put("indexed", "true");
|
||||||
args.put("precisionStep", "16");
|
args.put("stored", "false");
|
||||||
tdt.setArgs(schema, args);
|
args.put("docValues", "true");
|
||||||
assertTrue(tdt.hasProperty(FieldType.OMIT_NORMS));
|
args.put("precisionStep", "16");
|
||||||
assertTrue(tdt.hasProperty(FieldType.SORT_MISSING_LAST));
|
tdt.setArgs(schema, args);
|
||||||
assertTrue(tdt.hasProperty(FieldType.INDEXED));
|
assertEquals(16, tdt.getPrecisionStep());
|
||||||
assertFalse(tdt.hasProperty(FieldType.STORED));
|
}
|
||||||
assertTrue(tdt.hasProperty(FieldType.DOC_VALUES));
|
final DatePointField pdt = new DatePointField();
|
||||||
assertEquals(16, tdt.getPrecisionStep());
|
{
|
||||||
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestB
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addFieldTypePut(RestTestHarness publisher, String typeName, int updateTimeoutSecs) throws Exception {
|
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";
|
String request = "/schema/fieldtypes/" + typeName + "?wt=xml";
|
||||||
if (updateTimeoutSecs > 0)
|
if (updateTimeoutSecs > 0)
|
||||||
request += "&updateTimeoutSecs="+updateTimeoutSecs;
|
request += "&updateTimeoutSecs="+updateTimeoutSecs;
|
||||||
|
@ -158,7 +158,7 @@ public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestB
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addFieldTypePost(RestTestHarness publisher, String typeName, int updateTimeoutSecs) throws Exception {
|
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";
|
String request = "/schema/fieldtypes/?wt=xml";
|
||||||
if (updateTimeoutSecs > 0)
|
if (updateTimeoutSecs > 0)
|
||||||
request += "&updateTimeoutSecs="+updateTimeoutSecs;
|
request += "&updateTimeoutSecs="+updateTimeoutSecs;
|
||||||
|
|
|
@ -102,7 +102,6 @@ public class TestSchemalessBufferedUpdates extends SolrTestCaseJ4 {
|
||||||
// WARN [...] o.a.s.u.UpdateLog REYPLAY_ERR: IOException reading log
|
// WARN [...] o.a.s.u.UpdateLog REYPLAY_ERR: IOException reading log
|
||||||
// org.apache.solr.common.SolrException: Invalid Date String:'2017-01-05'
|
// 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.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));
|
updateJ(jsonAdd(processAdd(sdoc("id","2", "f_dt","2017-01-05"))), params(DISTRIB_UPDATE_PARAM,FROM_LEADER));
|
||||||
|
|
||||||
Future<UpdateLog.RecoveryInfo> rinfoFuture = ulog.applyBufferedUpdates();
|
Future<UpdateLog.RecoveryInfo> rinfoFuture = ulog.applyBufferedUpdates();
|
||||||
|
|
|
@ -24,22 +24,23 @@ import org.apache.lucene.search.SortField;
|
||||||
/**
|
/**
|
||||||
* Custom field wrapping an int, to test sorting via a custom comparator.
|
* Custom field wrapping an int, to test sorting via a custom comparator.
|
||||||
*/
|
*/
|
||||||
public class WrappedIntField extends TrieIntField {
|
public class WrappedIntPointField extends IntPointField {
|
||||||
Expression expr;
|
/** static helper for re-use in sibling trie class */
|
||||||
|
public static SortField getSortField(final SortField superSort, final SchemaField field) {
|
||||||
public WrappedIntField() {
|
field.checkSortability();
|
||||||
|
Expression expr = null;
|
||||||
try {
|
try {
|
||||||
expr = JavascriptCompiler.compile("payload % 3");
|
expr = JavascriptCompiler.compile(field.getName() + " % 3");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("impossible?", e);
|
throw new RuntimeException("impossible?", e);
|
||||||
}
|
}
|
||||||
|
SimpleBindings bindings = new SimpleBindings();
|
||||||
|
bindings.add(superSort);
|
||||||
|
return expr.getSortField(bindings, superSort.getReverse());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SortField getSortField(final SchemaField field, final boolean reverse) {
|
public SortField getSortField(final SchemaField field, final boolean reverse) {
|
||||||
field.checkSortability();
|
return getSortField(super.getSortField(field, reverse), field);
|
||||||
SimpleBindings bindings = new SimpleBindings();
|
|
||||||
bindings.add(super.getSortField(field, reverse));
|
|
||||||
return expr.getSortField(bindings, reverse);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,9 @@ public class TestFieldSortValues extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
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");
|
initCore("solrconfig-minimal.xml", "schema-field-sort-values.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.apache.solr.schema.TrieDateField;
|
|
||||||
import org.apache.solr.util.DateMathParser;
|
import org.apache.solr.util.DateMathParser;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -615,7 +614,6 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
doc = new SolrInputDocument();
|
doc = new SolrInputDocument();
|
||||||
doc.setField("id", "10001");
|
doc.setField("id", "10001");
|
||||||
TrieDateField trieDF = new TrieDateField();
|
|
||||||
Date tempDate = DateMathParser.parseMath(null, "2014-02-01T12:00:00Z");
|
Date tempDate = DateMathParser.parseMath(null, "2014-02-01T12:00:00Z");
|
||||||
doc.setField("dateRemove", new Date[]{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"),
|
DateMathParser.parseMath(null, "2014-07-02T12:00:00Z"),
|
||||||
|
|
Loading…
Reference in New Issue