Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

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

Chris Hostetter2552986e8722
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema_codec.xml b/solr/core/src/test-files/solr/collection1/conf/schema_codec.xml
index 5c88fcd14a6..3cb2f721cca 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema_codec.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema_codec.xml
@@ -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"/>
diff --git a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
index 2da830fc9b6..a3daeb8caad 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
@@ -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() {