Skip to content

Commit 19a8ca4

Browse files
committed
Update to Apache Lucene 10 for 3.0.0
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
1 parent 2dfd519 commit 19a8ca4

File tree

115 files changed

+264
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+264
-247
lines changed

.github/workflows/assemble.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
java: [ 11, 17, 21 ]
10+
java: [ 21, 23 ]
1111
os: [ubuntu-latest, windows-latest, macos-13]
1212
steps:
1313
- uses: actions/checkout@v4
@@ -16,17 +16,6 @@ jobs:
1616
with:
1717
java-version: ${{ matrix.java }}
1818
distribution: temurin
19-
- name: Set up JDK 17
20-
# See please https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#minimum_daemon_jvm_version
21-
if: matrix.java == 11
22-
uses: actions/setup-java@v4
23-
with:
24-
java-version: 17
25-
distribution: temurin
26-
- name: Set JAVA${{ matrix.java }}_HOME
27-
shell: bash
28-
run: |
29-
echo "JAVA${{ matrix.java }}_HOME=$JAVA_HOME_${{ matrix.java }}_${{ runner.arch }}" >> $GITHUB_ENV
3019
- name: Setup docker (missing on MacOS)
3120
id: setup_docker
3221
if: runner.os == 'macos'
@@ -47,8 +36,8 @@ jobs:
4736
shell: bash
4837
if: runner.os != 'macos'
4938
run: |
50-
./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE -Druntime.java=${{ matrix.java }}
39+
./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE
5140
- name: Run Gradle (assemble)
5241
if: runner.os == 'macos' && steps.setup_docker.outcome == 'success'
5342
run: |
54-
./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE -Druntime.java=${{ matrix.java }}
43+
./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE

.github/workflows/precommit.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
java: [ 11, 17, 21, 23 ]
10+
java: [ 21, 23 ]
1111
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
1212
steps:
1313
- uses: actions/checkout@v4
@@ -17,18 +17,7 @@ jobs:
1717
java-version: ${{ matrix.java }}
1818
distribution: temurin
1919
cache: gradle
20-
- name: Set up JDK 17
21-
# See please https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#minimum_daemon_jvm_version
22-
if: matrix.java == 11
23-
uses: actions/setup-java@v4
24-
with:
25-
java-version: 17
26-
distribution: temurin
27-
- name: Set JAVA${{ matrix.java }}_HOME
28-
shell: bash
29-
run: |
30-
echo "JAVA${{ matrix.java }}_HOME=$JAVA_HOME_${{ matrix.java }}_${{ runner.arch }}" >> $GITHUB_ENV
3120
- name: Run Gradle (precommit)
3221
shell: bash
3322
run: |
34-
./gradlew javadoc precommit --parallel -Druntime.java=${{ matrix.java }}
23+
./gradlew javadoc precommit --parallel

buildSrc/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ if (project != rootProject) {
171171

172172
allprojects {
173173
java {
174-
targetCompatibility = JavaVersion.VERSION_11
175-
sourceCompatibility = JavaVersion.VERSION_11
174+
targetCompatibility = JavaVersion.VERSION_21
175+
sourceCompatibility = JavaVersion.VERSION_21
176176
}
177177
}
178178

buildSrc/reaper/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
apply plugin: 'java'
1313

1414
java {
15-
targetCompatibility = JavaVersion.VERSION_11
16-
sourceCompatibility = JavaVersion.VERSION_11
15+
targetCompatibility = JavaVersion.VERSION_21
16+
sourceCompatibility = JavaVersion.VERSION_21
1717
}
1818

1919
jar {

buildSrc/src/testKit/thirdPartyAudit/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ dependencies {
4646
}
4747

4848
tasks.register("empty", ThirdPartyAuditTask) {
49-
targetCompatibility = JavaVersion.VERSION_11
49+
targetCompatibility = JavaVersion.VERSION_21
5050
signatureFile = file('third-party-audit-empty.txt')
5151
}
5252

5353
tasks.register("absurd", ThirdPartyAuditTask) {
54-
targetCompatibility = JavaVersion.VERSION_11
54+
targetCompatibility = JavaVersion.VERSION_21
5555
signatureFile = file('third-party-audit-absurd.txt')
5656
}

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
opensearch = 3.0.0
2-
lucene = 9.12.0
2+
lucene = 10.0.0
33

44
bundled_jdk_vendor = adoptium
55
bundled_jdk = 23+37
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5a9b3f728041df5b054aaaed3c3fd7ff0fed8ee7

libs/core/licenses/lucene-core-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/core/src/main/java/org/opensearch/LegacyESVersion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class LegacyESVersion extends Version {
5050

5151
public static final LegacyESVersion V_6_0_0 = new LegacyESVersion(6000099, org.apache.lucene.util.Version.fromBits(7, 0, 0));
5252
public static final LegacyESVersion V_6_5_0 = new LegacyESVersion(6050099, org.apache.lucene.util.Version.fromBits(7, 0, 0));
53-
public static final LegacyESVersion V_7_2_0 = new LegacyESVersion(7020099, org.apache.lucene.util.Version.LUCENE_8_0_0);
53+
public static final LegacyESVersion V_7_2_0 = new LegacyESVersion(7020099, org.apache.lucene.util.Version.fromBits(8, 0, 0));
5454

5555
// todo move back to Version.java if retiring legacy version support
5656
protected static final Map<Integer, Version> idToVersion;

libs/core/src/main/java/org/opensearch/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public class Version implements Comparable<Version>, ToXContentFragment {
112112
public static final Version V_2_17_1 = new Version(2170199, org.apache.lucene.util.Version.LUCENE_9_11_1);
113113
public static final Version V_2_17_2 = new Version(2170299, org.apache.lucene.util.Version.LUCENE_9_11_1);
114114
public static final Version V_2_18_0 = new Version(2180099, org.apache.lucene.util.Version.LUCENE_9_12_0);
115-
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_12_0);
115+
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_10_0_0);
116116
public static final Version CURRENT = V_3_0_0;
117117

118118
public static Version fromId(int id) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
89b26348ec305598fc224cc9583939564b67b2cf

modules/lang-expression/licenses/lucene-expressions-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
082c38c1335c069a73622c37ca3d39e64c1b2d33

plugins/analysis-icu/licenses/lucene-analysis-icu-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
26071742008630779523d08c0b46b2f371ef23a0

plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4a6ff02a1bd34a3c0165da05f714bb8188074bdc

plugins/analysis-nori/licenses/lucene-analysis-nori-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4c488697df5038a78e5e65bb9b6da120af62d824

plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1137b9846ec000b49c70c3fe5f8cd79b7129be22

plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3fd86db5e9748063369db4bed84f1bd2ca62d387

plugins/analysis-stempel/licenses/lucene-analysis-stempel-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4e6b940b3b934d6de174fedaaeaefd647698648d

plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
13eb016bab14973158554a2e6cdf2abbc5c3eda1

server/licenses/lucene-analysis-common-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8e21f708eb1bbb71ce79cbfea093b6ca913f4abf

server/licenses/lucene-backward-codecs-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5a9b3f728041df5b054aaaed3c3fd7ff0fed8ee7

server/licenses/lucene-core-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
17145d786d31e7ecd68d149ccc3e7ab83270f282

server/licenses/lucene-grouping-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b8324f1b859620912c186b27d9666215ce3d258b

server/licenses/lucene-highlighter-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3a4c5bf84c855b011e740f30cb8a23f2ee85e1c1

server/licenses/lucene-join-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bc0f37a0a06b445555d07e5fe199d73436d51352

server/licenses/lucene-memory-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5f619b32c62bb9405e7af595cf7311113ed62e33

server/licenses/lucene-misc-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3d2f98787e27e8e2a65d994c86563edf16dd92f1

server/licenses/lucene-queries-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e11886c913058ef20378715dee715d942d04babc

server/licenses/lucene-queryparser-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1795ce5b066bda61483c375f6b8e358aaa4f6348

server/licenses/lucene-sandbox-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a701eb363cf0a75ebacd1844398314250abcf592

server/licenses/lucene-spatial-extras-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d9e0a8a6084d7657a633c1aa94d750414f5288c4

server/licenses/lucene-spatial3d-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d79099abc148a1906e129abbabd5e1b18a20c117

server/licenses/lucene-suggest-9.12.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.

server/src/main/java/org/apache/lucene/search/grouping/CollapseTopFieldDocs.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ public static CollapseTopFieldDocs merge(Sort sort, int start, int size, Collaps
192192
final CollapseTopFieldDocs shard = shardHits[shardIDX];
193193
// totalHits can be non-zero even if no hits were
194194
// collected, when searchAfter was used:
195-
totalHitCount += shard.totalHits.value;
195+
totalHitCount += shard.totalHits.value();
196196
// If any hit count is a lower bound then the merged
197197
// total hit count is a lower bound as well
198-
if (shard.totalHits.relation == TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO) {
198+
if (shard.totalHits.relation() == TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO) {
199199
totalHitsRelation = TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO;
200200
}
201201
if (CollectionUtils.isEmpty(shard.scoreDocs) == false) {

server/src/main/java/org/apache/lucene/search/grouping/CollapsingDocValuesSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void setNextReader(LeafReaderContext readerContext) throws IOException {
229229
public boolean advanceExact(int target) throws IOException {
230230
if (sorted.advanceExact(target)) {
231231
ord = (int) sorted.nextOrd();
232-
if (sorted.nextOrd() != SortedSetDocValues.NO_MORE_ORDS) {
232+
if (sorted.nextOrd() != SortedSetDocValues.NO_MORE_DOCS) {
233233
throw new IllegalStateException(
234234
"failed to collapse " + target + ", the collapse field must be single valued"
235235
);

server/src/main/java/org/apache/lucene/util/packed/XPackedInts.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public static Reader getDirectReader(IndexInput in) throws IOException {
534534
*/
535535
public static Mutable getMutable(int valueCount, int bitsPerValue, float acceptableOverheadRatio) {
536536
final FormatAndBits formatAndBits = fastestFormatAndBits(valueCount, bitsPerValue, acceptableOverheadRatio);
537-
return getMutable(valueCount, formatAndBits.bitsPerValue, formatAndBits.format);
537+
return getMutable(valueCount, formatAndBits.bitsPerValue(), formatAndBits.format());
538538
}
539539

540540
/**
@@ -629,7 +629,13 @@ public static Writer getWriter(DataOutput out, int valueCount, int bitsPerValue,
629629
assert valueCount >= 0;
630630

631631
final FormatAndBits formatAndBits = fastestFormatAndBits(valueCount, bitsPerValue, acceptableOverheadRatio);
632-
final XWriter writer = getWriterNoHeader(out, formatAndBits.format, valueCount, formatAndBits.bitsPerValue, DEFAULT_BUFFER_SIZE);
632+
final XWriter writer = getWriterNoHeader(
633+
out,
634+
formatAndBits.format(),
635+
valueCount,
636+
formatAndBits.bitsPerValue(),
637+
DEFAULT_BUFFER_SIZE
638+
);
633639
writer.writeHeader();
634640
return writer;
635641
}

server/src/main/java/org/opensearch/action/search/BottomSortValuesCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ SearchSortValuesAndFormats getBottomSortValues() {
7777
}
7878

7979
synchronized void consumeTopDocs(TopFieldDocs topDocs, DocValueFormat[] sortValuesFormat) {
80-
totalHits += topDocs.totalHits.value;
80+
totalHits += topDocs.totalHits.value();
8181
if (validateShardSortFields(topDocs.fields) == false) {
8282
return;
8383
}

server/src/main/java/org/opensearch/action/search/SearchPhaseController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,8 @@ TotalHits getTotalHits() {
802802

803803
void add(TopDocsAndMaxScore topDocs, boolean timedOut, Boolean terminatedEarly) {
804804
if (trackTotalHitsUpTo != SearchContext.TRACK_TOTAL_HITS_DISABLED) {
805-
totalHits += topDocs.topDocs.totalHits.value;
806-
if (topDocs.topDocs.totalHits.relation == Relation.GREATER_THAN_OR_EQUAL_TO) {
805+
totalHits += topDocs.topDocs.totalHits.value();
806+
if (topDocs.topDocs.totalHits.relation() == Relation.GREATER_THAN_OR_EQUAL_TO) {
807807
totalHitsRelation = TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO;
808808
}
809809
}

server/src/main/java/org/opensearch/bootstrap/BootstrapChecks.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ String jvmVendor() {
703703
}
704704

705705
String javaVersion() {
706-
return Constants.JAVA_VERSION;
706+
return Runtime.version().toString();
707707
}
708708

709709
}

server/src/main/java/org/opensearch/common/lucene/Lucene.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ public static ScoreDoc readScoreDoc(StreamInput in) throws IOException {
423423
private static final Class<?> GEO_DISTANCE_SORT_TYPE_CLASS = LatLonDocValuesField.newDistanceSort("some_geo_field", 0, 0).getClass();
424424

425425
public static void writeTotalHits(StreamOutput out, TotalHits totalHits) throws IOException {
426-
out.writeVLong(totalHits.value);
427-
out.writeEnum(totalHits.relation);
426+
out.writeVLong(totalHits.value());
427+
out.writeEnum(totalHits.relation());
428428
}
429429

430430
public static void writeTopDocs(StreamOutput out, TopDocsAndMaxScore topDocs) throws IOException {

server/src/main/java/org/opensearch/common/lucene/index/FilterableTermsEnum.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.apache.lucene.util.BitSet;
5151
import org.apache.lucene.util.Bits;
5252
import org.apache.lucene.util.BytesRef;
53+
import org.apache.lucene.util.IOBooleanSupplier;
5354
import org.opensearch.common.Nullable;
5455

5556
import java.io.IOException;
@@ -256,4 +257,9 @@ public ImpactsEnum impacts(int flags) throws IOException {
256257
public BytesRef next() throws IOException {
257258
throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE);
258259
}
260+
261+
@Override
262+
public IOBooleanSupplier prepareSeekExact(BytesRef text) throws IOException {
263+
throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE);
264+
}
259265
}

server/src/main/java/org/opensearch/common/lucene/search/Queries.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static Query applyMinimumShouldMatch(BooleanQuery query, @Nullable String
137137
}
138138
int optionalClauses = 0;
139139
for (BooleanClause c : query.clauses()) {
140-
if (c.getOccur() == BooleanClause.Occur.SHOULD) {
140+
if (c.occur() == BooleanClause.Occur.SHOULD) {
141141
optionalClauses++;
142142
}
143143
}

0 commit comments

Comments
 (0)