Skip to content

Commit 1887280

Browse files
authored
LUCENE-9322: Move old field infos format to backwards-codecs. (#2245)
We introduced a new `Lucene90FieldInfosFormat`, so the old `Lucene60FieldInfosFormat` should live in backwards-codecs.
1 parent 2b8d7bc commit 1887280

File tree

11 files changed

+17
-38
lines changed

11 files changed

+17
-38
lines changed

lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java renamed to lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene60/Lucene60FieldInfosFormat.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.lucene.codecs.lucene60;
17+
package org.apache.lucene.backward_codecs.lucene60;
1818

1919
import java.io.IOException;
2020
import java.util.Collections;
@@ -311,6 +311,11 @@ private static IndexOptions getIndexOptions(IndexInput input, byte b) throws IOE
311311
}
312312
}
313313

314+
/**
315+
* Note: although this format is only used on older versions, we need to keep the write logic in
316+
* addition to the read logic. It's possible for field infos on older segments to be written to,
317+
* for example as part of in-place doc values updates.
318+
*/
314319
@Override
315320
public void write(
316321
Directory directory,

lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import org.apache.lucene.backward_codecs.lucene50.Lucene50StoredFieldsFormat;
2020
import org.apache.lucene.backward_codecs.lucene50.Lucene50StoredFieldsFormat.Mode;
21+
import org.apache.lucene.backward_codecs.lucene60.Lucene60FieldInfosFormat;
2122
import org.apache.lucene.backward_codecs.lucene60.Lucene60PointsFormat;
2223
import org.apache.lucene.codecs.Codec;
2324
import org.apache.lucene.codecs.CompoundFormat;
@@ -35,7 +36,6 @@
3536
import org.apache.lucene.codecs.lucene50.Lucene50CompoundFormat;
3637
import org.apache.lucene.codecs.lucene50.Lucene50LiveDocsFormat;
3738
import org.apache.lucene.codecs.lucene50.Lucene50TermVectorsFormat;
38-
import org.apache.lucene.codecs.lucene60.Lucene60FieldInfosFormat;
3939
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;
4040
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
4141

lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.lucene.backward_codecs.lucene80;
1818

1919
import org.apache.lucene.backward_codecs.lucene50.Lucene50StoredFieldsFormat;
20+
import org.apache.lucene.backward_codecs.lucene60.Lucene60FieldInfosFormat;
2021
import org.apache.lucene.backward_codecs.lucene60.Lucene60PointsFormat;
2122
import org.apache.lucene.backward_codecs.lucene70.Lucene70SegmentInfoFormat;
2223
import org.apache.lucene.codecs.Codec;
@@ -34,7 +35,6 @@
3435
import org.apache.lucene.codecs.lucene50.Lucene50CompoundFormat;
3536
import org.apache.lucene.codecs.lucene50.Lucene50LiveDocsFormat;
3637
import org.apache.lucene.codecs.lucene50.Lucene50TermVectorsFormat;
37-
import org.apache.lucene.codecs.lucene60.Lucene60FieldInfosFormat;
3838
import org.apache.lucene.codecs.lucene80.Lucene80NormsFormat;
3939
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;
4040
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;

lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/Lucene84Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Objects;
2020
import org.apache.lucene.backward_codecs.lucene50.Lucene50StoredFieldsFormat;
2121
import org.apache.lucene.backward_codecs.lucene50.Lucene50StoredFieldsFormat.Mode;
22+
import org.apache.lucene.backward_codecs.lucene60.Lucene60FieldInfosFormat;
2223
import org.apache.lucene.backward_codecs.lucene60.Lucene60PointsFormat;
2324
import org.apache.lucene.backward_codecs.lucene70.Lucene70SegmentInfoFormat;
2425
import org.apache.lucene.codecs.Codec;
@@ -37,7 +38,6 @@
3738
import org.apache.lucene.codecs.lucene50.Lucene50CompoundFormat;
3839
import org.apache.lucene.codecs.lucene50.Lucene50LiveDocsFormat;
3940
import org.apache.lucene.codecs.lucene50.Lucene50TermVectorsFormat;
40-
import org.apache.lucene.codecs.lucene60.Lucene60FieldInfosFormat;
4141
import org.apache.lucene.codecs.lucene80.Lucene80NormsFormat;
4242
import org.apache.lucene.codecs.lucene84.Lucene84PostingsFormat;
4343
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;

lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene86/Lucene86Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.util.Objects;
2121
import org.apache.lucene.backward_codecs.lucene50.Lucene50StoredFieldsFormat;
22+
import org.apache.lucene.backward_codecs.lucene60.Lucene60FieldInfosFormat;
2223
import org.apache.lucene.codecs.Codec;
2324
import org.apache.lucene.codecs.CompoundFormat;
2425
import org.apache.lucene.codecs.DocValuesFormat;
@@ -35,7 +36,6 @@
3536
import org.apache.lucene.codecs.lucene50.Lucene50CompoundFormat;
3637
import org.apache.lucene.codecs.lucene50.Lucene50LiveDocsFormat;
3738
import org.apache.lucene.codecs.lucene50.Lucene50TermVectorsFormat;
38-
import org.apache.lucene.codecs.lucene60.Lucene60FieldInfosFormat;
3939
import org.apache.lucene.codecs.lucene80.Lucene80NormsFormat;
4040
import org.apache.lucene.codecs.lucene84.Lucene84PostingsFormat;
4141
import org.apache.lucene.codecs.lucene86.Lucene86PointsFormat;

lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene87/Lucene87Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.lucene.backward_codecs.lucene87;
1919

2020
import java.util.Objects;
21+
import org.apache.lucene.backward_codecs.lucene60.Lucene60FieldInfosFormat;
2122
import org.apache.lucene.codecs.Codec;
2223
import org.apache.lucene.codecs.CompoundFormat;
2324
import org.apache.lucene.codecs.DocValuesFormat;
@@ -34,7 +35,6 @@
3435
import org.apache.lucene.codecs.lucene50.Lucene50CompoundFormat;
3536
import org.apache.lucene.codecs.lucene50.Lucene50LiveDocsFormat;
3637
import org.apache.lucene.codecs.lucene50.Lucene50TermVectorsFormat;
37-
import org.apache.lucene.codecs.lucene60.Lucene60FieldInfosFormat;
3838
import org.apache.lucene.codecs.lucene80.Lucene80DocValuesFormat;
3939
import org.apache.lucene.codecs.lucene80.Lucene80NormsFormat;
4040
import org.apache.lucene.codecs.lucene84.Lucene84PostingsFormat;

lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestLucene60FieldInfoFormat.java renamed to lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/TestLucene60FieldInfosFormat.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.lucene.codecs.lucene50;
17+
package org.apache.lucene.backward_codecs.lucene60;
1818

19+
import org.apache.lucene.backward_codecs.lucene84.Lucene84RWCodec;
1920
import org.apache.lucene.codecs.Codec;
2021
import org.apache.lucene.index.BaseFieldInfoFormatTestCase;
21-
import org.apache.lucene.util.TestUtil;
22-
23-
/** Tests Lucene60FieldInfoFormat */
24-
public class TestLucene60FieldInfoFormat extends BaseFieldInfoFormatTestCase {
2522

23+
public class TestLucene60FieldInfosFormat extends BaseFieldInfoFormatTestCase {
2624
@Override
2725
protected Codec getCodec() {
28-
return TestUtil.getDefaultCodec();
26+
return new Lucene84RWCodec();
2927
}
3028
}

lucene/core/src/java/org/apache/lucene/codecs/lucene60/package-info.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

lucene/core/src/java/org/apache/lucene/codecs/lucene90/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
* systems that frequently run out of file handles.</td>
241241
* </tr>
242242
* <tr>
243-
* <td>{@link org.apache.lucene.codecs.lucene60.Lucene60FieldInfosFormat Fields}</td>
243+
* <td>{@link org.apache.lucene.codecs.lucene90.Lucene90FieldInfosFormat Fields}</td>
244244
* <td>.fnm</td>
245245
* <td>Stores information about the fields</td>
246246
* </tr>

lucene/facet/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ dependencies {
2828
testImplementation project(':lucene:test-framework')
2929
testImplementation project(':lucene:queries')
3030
// Required for opening older indexes for backward compatibility tests
31-
testCompile group: 'org.apache.lucene', name: 'lucene-codecs', version: '8.6.3'
31+
testImplementation project(':lucene:backward-codecs')
3232
}

0 commit comments

Comments
 (0)