You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by so...@apache.org on 2026/04/30 13:06:01 UTC

(lucene) branch branch_10x updated: Skip testing back-compat of unsupported DOCS_AND_CUSTOM_FREQS in 6.0 format

This is an automated email from the ASF dual-hosted git repository.

msokolov pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_10x by this push:
     new ca0a2b13e45 Skip testing back-compat of unsupported DOCS_AND_CUSTOM_FREQS in 6.0 format
ca0a2b13e45 is described below

commit ca0a2b13e45ed48e06be7a8e4342a982822d3a23
Author: Michael Sokolov <so...@amazon.com>
AuthorDate: Wed Apr 29 15:52:32 2026 -0400

    Skip testing back-compat of unsupported DOCS_AND_CUSTOM_FREQS in 6.0 format
---
 .../lucene60/TestLucene60FieldInfosFormat.java             |  5 +++++
 .../lucene/tests/index/BaseFieldInfoFormatTestCase.java    | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java
index 0b9e9f72672..de3dcbfaf50 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java
@@ -32,4 +32,9 @@ public class TestLucene60FieldInfosFormat extends BaseFieldInfoFormatTestCase {
   protected boolean supportDocValuesSkipIndex() {
     return false;
   }
+
+  @Override
+  protected boolean supportCustomTermFreqs() {
+    return false;
+  }
 }
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java
index 101a467c41a..29faf87ce1b 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java
@@ -69,6 +69,14 @@ public abstract class BaseFieldInfoFormatTestCase extends BaseIndexFileFormatTes
     return true;
   }
 
+  /**
+   * Override and return {@code false} if the format does not support
+   * IndexOption.DOCS_AND_CUSTOM_TERM_FREQS.
+   */
+  protected boolean supportCustomTermFreqs() {
+    return true;
+  }
+
   /** Test field infos read/write with a single field */
   public void testOneField() throws Exception {
     Directory dir = newDirectory();
@@ -352,7 +360,11 @@ public abstract class BaseFieldInfoFormatTestCase extends BaseIndexFileFormatTes
 
     if (r.nextBoolean()) {
       IndexOptions[] values = IndexOptions.values();
-      type.setIndexOptions(values[r.nextInt(values.length)]);
+      IndexOptions indexOptions = values[r.nextInt(values.length)];
+      if (indexOptions == IndexOptions.DOCS_AND_CUSTOM_FREQS && !supportCustomTermFreqs()) {
+        indexOptions = IndexOptions.DOCS_AND_FREQS;
+      }
+      type.setIndexOptions(indexOptions);
       type.setOmitNorms(r.nextBoolean());
 
       if (r.nextBoolean()) {