Skip to content

Commit 467de1b

Browse files
committed
fix default postings format - aligned with changes in main
1 parent 4c2c3d9 commit 467de1b

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/index/codec/tsdb/TSDBDocValuesMergeBenchmark.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
public class TSDBDocValuesMergeBenchmark {
6464

6565
static {
66-
// For Elasticsearch900Lucene101Codec:
6766
LogConfigurator.loadLog4jPlugins();
6867
LogConfigurator.configureESLogging();
6968
LogConfigurator.setNodeName("test");

server/src/main/java/org/elasticsearch/index/codec/Elasticsearch92Lucene103Codec.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
*/
2929
public class Elasticsearch92Lucene103Codec extends CodecService.DeduplicateFieldInfosCodec {
3030

31+
static final PostingsFormat DEFAULT_POSTINGS_FORMAT = new Lucene103PostingsFormat();
32+
3133
private final StoredFieldsFormat storedFieldsFormat;
3234

3335
private final PostingsFormat defaultPostingsFormat;

server/src/main/java/org/elasticsearch/index/codec/PerFieldFormatSupplier.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010
package org.elasticsearch.index.codec;
1111

12-
import org.apache.lucene.backward_codecs.lucene101.Lucene101PostingsFormat;
1312
import org.apache.lucene.codecs.DocValuesFormat;
1413
import org.apache.lucene.codecs.KnnVectorsFormat;
1514
import org.apache.lucene.codecs.PostingsFormat;
16-
import org.apache.lucene.codecs.lucene103.Lucene103PostingsFormat;
1715
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
1816
import org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat;
1917
import org.elasticsearch.common.util.BigArrays;
@@ -35,8 +33,7 @@
3533
* vectors.
3634
*/
3735
public class PerFieldFormatSupplier {
38-
public static final FeatureFlag USE_LUCENE101_POSTINGS_FORMAT = new FeatureFlag("use_lucene101_postings_format");
39-
public static final FeatureFlag USE_LUCENE103_POSTINGS_FORMAT = new FeatureFlag("use_lucene103_postings_format");
36+
public static final FeatureFlag USE_DEFAULT_LUCENE_POSTINGS_FORMAT = new FeatureFlag("use_default_lucene_postings_format");
4037

4138
private static final DocValuesFormat docValuesFormat = new Lucene90DocValuesFormat();
4239
private static final KnnVectorsFormat knnVectorsFormat = new Lucene99HnswVectorsFormat();
@@ -54,19 +51,14 @@ public PerFieldFormatSupplier(MapperService mapperService, BigArrays bigArrays)
5451
this.bloomFilterPostingsFormat = new ES87BloomFilterPostingsFormat(bigArrays, this::internalGetPostingsFormatForField);
5552

5653
if (mapperService != null
57-
&& USE_LUCENE103_POSTINGS_FORMAT.isEnabled()
54+
&& USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
5855
&& mapperService.getIndexSettings().getIndexVersionCreated().onOrAfter(IndexVersions.UPGRADE_TO_LUCENE_10_3_0)
5956
&& mapperService.getIndexSettings().getMode() == IndexMode.STANDARD) {
60-
defaultPostingsFormat = new Lucene103PostingsFormat();
61-
} else if (mapperService != null
62-
&& USE_LUCENE101_POSTINGS_FORMAT.isEnabled()
63-
&& mapperService.getIndexSettings().getIndexVersionCreated().onOrAfter(IndexVersions.USE_LUCENE101_POSTINGS_FORMAT)
64-
&& mapperService.getIndexSettings().getMode() == IndexMode.STANDARD) {
65-
defaultPostingsFormat = new Lucene101PostingsFormat();
66-
} else {
67-
// our own posting format using PFOR
68-
defaultPostingsFormat = es812PostingsFormat;
69-
}
57+
defaultPostingsFormat = Elasticsearch92Lucene103Codec.DEFAULT_POSTINGS_FORMAT;
58+
} else {
59+
// our own posting format using PFOR
60+
defaultPostingsFormat = es812PostingsFormat;
61+
}
7062
}
7163

7264
public PostingsFormat getPostingsFormatForField(String field) {

server/src/test/java/org/elasticsearch/index/codec/PerFieldMapperCodecTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void testUseBloomFilter() throws IOException {
9494
assertThat(perFieldMapperCodec.getPostingsFormatForField("_id"), instanceOf(ES87BloomFilterPostingsFormat.class));
9595
assertThat(perFieldMapperCodec.useBloomFilter("another_field"), is(false));
9696

97-
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_LUCENE103_POSTINGS_FORMAT.isEnabled()
97+
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
9898
&& timeSeries == false ? Lucene103PostingsFormat.class : ES812PostingsFormat.class;
9999
assertThat(perFieldMapperCodec.getPostingsFormatForField("another_field"), instanceOf(expectedPostingsFormat));
100100
}
@@ -110,7 +110,7 @@ public void testUseBloomFilterWithTimestampFieldEnabled() throws IOException {
110110
public void testUseBloomFilterWithTimestampFieldEnabled_noTimeSeriesMode() throws IOException {
111111
PerFieldFormatSupplier perFieldMapperCodec = createFormatSupplier(true, false, false);
112112
assertThat(perFieldMapperCodec.useBloomFilter("_id"), is(false));
113-
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_LUCENE103_POSTINGS_FORMAT.isEnabled()
113+
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
114114
? Lucene103PostingsFormat.class
115115
: ES812PostingsFormat.class;
116116
assertThat(perFieldMapperCodec.getPostingsFormatForField("_id"), instanceOf(expectedPostingsFormat));

server/src/test/java/org/elasticsearch/index/codec/tsdb/ES87TSDBDocValuesFormatTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public class ES87TSDBDocValuesFormatTests extends BaseDocValuesFormatTestCase {
5252
private static final int NUM_DOCS = 10;
5353

5454
static {
55-
// For Elasticsearch900Lucene101Codec:
5655
LogConfigurator.loadLog4jPlugins();
5756
LogConfigurator.configureESLogging();
5857
}

0 commit comments

Comments
 (0)