Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import org.apache.lucene.codecs.KnnVectorsReader;
import org.apache.lucene.codecs.KnnVectorsWriter;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.lucene99.Lucene99Codec;
import org.apache.lucene.codecs.lucene99.Lucene99Codec.Mode;
import org.apache.lucene.codecs.lucene95.Lucene95Codec;
import org.apache.lucene.codecs.lucene95.Lucene95Codec.Mode;
import org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat;
import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.index.SegmentWriteState;
Expand Down Expand Up @@ -97,7 +97,7 @@ public void init(NamedList<?> args) {
log.debug("Using default compressionMode: {}", compressionMode);
}
codec =
new Lucene99Codec(compressionMode) {
new Lucene95Codec(compressionMode) {
@Override
public PostingsFormat getPostingsFormatForField(String field) {
final SchemaField schemaField = core.getLatestSchema().getFieldOrNull(field);
Expand Down
4 changes: 2 additions & 2 deletions solr/core/src/java/org/apache/solr/schema/BloomStrField.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.KeywordTokenizer;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.lucene95.Lucene95Codec;
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.IndexReader;
Expand Down Expand Up @@ -101,7 +101,7 @@ protected void init(IndexSchema schema, Map<String, String> args) {
pf = PostingsFormat.forName(postingsFormat);
} else {
// start with the default postingsFormat.
pf = Codec.getDefault().postingsFormat();
pf = new Lucene95Codec().postingsFormat(); // temporarily hardcode to Lucene95Codec
if (pf instanceof PerFieldPostingsFormat) {
pf = ((PerFieldPostingsFormat) pf).getPostingsFormatForField("");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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="Lucene99"/>
<fieldType name="string_standard" class="solr.StrField" postingsFormat="Lucene90"/>

<fieldType name="string_disk" class="solr.StrField" />

Expand Down
17 changes: 15 additions & 2 deletions solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
import java.io.IOException;
import java.util.Map;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.lucene99.Lucene99Codec.Mode;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.lucene90.Lucene90PostingsFormat;
import org.apache.lucene.codecs.lucene95.Lucene95Codec.Mode;
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.SegmentInfos;
import org.apache.lucene.tests.util.TestUtil;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.NamedList;
Expand All @@ -38,6 +40,17 @@

public class TestCodecSupport extends SolrTestCaseJ4 {

private static final class TestUtil {
// FS: temporarily shim TestUtil to override the default postings format
private static PostingsFormat getDefaultPostingsFormat() {
return new Lucene90PostingsFormat();
}

private static DocValuesFormat getDefaultDocValuesFormat() {
return org.apache.lucene.tests.util.TestUtil.getDefaultDocValuesFormat();
}
}

@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig_codec.xml", "schema_codec.xml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import java.lang.reflect.Modifier;
import java.util.Set;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.KnnVectorsFormat;
import org.apache.lucene.codecs.lucene95.Lucene95Codec;
import org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat;
import org.apache.lucene.tests.util.TestUtil;
import org.apache.solr.SolrTestCaseJ4;
import org.junit.BeforeClass;
Expand All @@ -41,7 +44,13 @@
public class TestSchemaCodecFactoryDefaults extends SolrTestCaseJ4 {

// Note: we use TestUtil to get the "real" (not randomized) default for our current lucene version
private static final Codec LUCENE_DEFAULT_CODEC = TestUtil.getDefaultCodec();
private static final Codec LUCENE_DEFAULT_CODEC =
new Lucene95Codec() {
@Override
public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
return new Lucene99HnswVectorsFormat();
}
};

@BeforeClass
public static void beforeClass() throws Exception {
Expand Down Expand Up @@ -77,7 +86,7 @@ public void testSubclass() {
assertThat(
"SchemaCodec does not extend current default lucene codec",
h.getCore().getCodec(),
instanceOf(LUCENE_DEFAULT_CODEC.getClass()));
instanceOf(Lucene95Codec.class));
}

/**
Expand Down