LUCENE-8917: Fix Solr's TestCodecSupport to stop trying to use the now-removed Direct docValues format

This commit is contained in:
Chris Hostetter 2019-09-05 12:11:49 -07:00
parent 106ae969e0
commit 2552986e87
2 changed files with 11 additions and 4 deletions

View File

@ -16,7 +16,10 @@
limitations under the License.
-->
<schema name="codec" version="1.2">
<fieldType name="string_direct" class="solr.StrField" postingsFormat="Direct" docValuesFormat="Direct"/>
<!-- NOTE: Direct (and Disk) DocValues formats were removed, so we use "Asserting"
as a way to vet that the configuration actually matters.
-->
<fieldType name="string_direct" class="solr.StrField" postingsFormat="Direct" docValuesFormat="Asserting" />
<fieldType name="string_standard" class="solr.StrField" postingsFormat="Lucene50"/>
<fieldType name="string_disk" class="solr.StrField" docValuesFormat="Lucene80"/>

View File

@ -56,13 +56,15 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
}
public void testDocValuesFormats() {
// NOTE: Direct (and Disk) DocValues formats were removed, so we use "Asserting"
// as a way to vet that the configuration actually matters.
Codec codec = h.getCore().getCodec();
Map<String, SchemaField> fields = h.getCore().getLatestSchema().getFields();
SchemaField schemaField = fields.get("string_disk_f");
PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat();
assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField(schemaField.getName()).getName());
schemaField = fields.get("string_direct_f");
assertEquals("Direct", format.getDocValuesFormatForField(schemaField.getName()).getName());
assertEquals("Asserting", format.getDocValuesFormatForField(schemaField.getName()).getName());
schemaField = fields.get("string_f");
assertEquals(TestUtil.getDefaultDocValuesFormat().getName(),
format.getDocValuesFormatForField(schemaField.getName()).getName());
@ -79,13 +81,15 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
}
public void testDynamicFieldsDocValuesFormats() {
// NOTE: Direct (and Disk) DocValues formats were removed, so we use "Asserting"
// as a way to vet that the configuration actually matters.
Codec codec = h.getCore().getCodec();
PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat();
assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField("foo_disk").getName());
assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField("bar_disk").getName());
assertEquals("Direct", format.getDocValuesFormatForField("foo_direct").getName());
assertEquals("Direct", format.getDocValuesFormatForField("bar_direct").getName());
assertEquals("Asserting", format.getDocValuesFormatForField("foo_direct").getName());
assertEquals("Asserting", format.getDocValuesFormatForField("bar_direct").getName());
}
private void reloadCoreAndRecreateIndex() {