mirror of https://github.com/apache/lucene.git
SOLR-6704: Added unit tests that uncovered TrieDateField bug in branch 4.10.x
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1636980 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb1443fd81
commit
a741d433d0
|
@ -372,6 +372,8 @@ Bug Fixes
|
|||
|
||||
* SOLR-6696: bin/solr start script should not enable autoSoftCommit by default (janhoy)
|
||||
|
||||
* SOLR-6704: TrieDateField type drops schema properties in branch 4.10 (Tomás Fernández Löbbe)
|
||||
|
||||
================== 4.10.2 ==================
|
||||
|
||||
Bug Fixes
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
-->
|
||||
<fieldtype name="date" class="solr.TrieDateField" precisionStep="0"/>
|
||||
<fieldtype name="tdate" class="solr.TrieDateField" precisionStep="6"/>
|
||||
<fieldtype name="tdatedv" class="solr.TrieDateField" precisionStep="6" docValues="true" multiValued="true"/>
|
||||
|
||||
<fieldtype name="dateRange" class="solr.DateRangeField" />
|
||||
|
||||
|
@ -573,6 +574,7 @@
|
|||
<dynamicField name="*_tds" type="tdouble" indexed="true" stored="true" multiValued="false"/>
|
||||
<dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_tdt1" type="tdate" indexed="true" stored="true" multiValued="false"/>
|
||||
<dynamicField name="*_tdtdv" type="tdatedv" indexed="true" stored="true"/>
|
||||
|
||||
<dynamicField name="*_sI" type="string" indexed="true" stored="false"/>
|
||||
<dynamicField name="*_sS" type="string" indexed="false" stored="true"/>
|
||||
|
|
|
@ -92,5 +92,20 @@ public class IndexSchemaTest extends SolrTestCaseJ4 {
|
|||
SolrCore core = h.getCore();
|
||||
IndexSchema schema = core.getLatestSchema();
|
||||
assertFalse(schema.getField("id").multiValued());
|
||||
|
||||
// Test TrieDate fields. The following asserts are expecting a field type defined as:
|
||||
String expectedDefinition = "<fieldtype name=\"tdatedv\" class=\"solr.TrieDateField\" " +
|
||||
"precisionStep=\"6\" docValues=\"true\" multiValued=\"true\"/>";
|
||||
FieldType tdatedv = schema.getFieldType("foo_tdtdv");
|
||||
assertTrue("Expecting a field type defined as " + expectedDefinition,
|
||||
tdatedv instanceof TrieDateField);
|
||||
assertTrue("Expecting a field type defined as " + expectedDefinition,
|
||||
tdatedv.hasProperty(FieldProperties.DOC_VALUES));
|
||||
assertTrue("Expecting a field type defined as " + expectedDefinition,
|
||||
tdatedv.isMultiValued());
|
||||
assertEquals("Expecting a field type defined as " + expectedDefinition,
|
||||
6, ((TrieDateField)tdatedv).getPrecisionStep());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.junit.Test;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
|
@ -153,4 +154,22 @@ public class PrimitiveFieldTypeTest extends SolrTestCaseJ4 {
|
|||
bin.init(schema, initMap);
|
||||
assertFalse(bin.hasProperty(FieldType.OMIT_NORMS));
|
||||
}
|
||||
|
||||
public void testTrieDateField() {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue