diff --git a/.github/workflows/assemble.yml b/.github/workflows/assemble.yml index d90b05c323cf1..4146a74c47a1f 100644 --- a/.github/workflows/assemble.yml +++ b/.github/workflows/assemble.yml @@ -7,7 +7,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - java: [ 11, 17, 21 ] + java: [ 21, 23 ] os: [ubuntu-latest, windows-latest, macos-13] steps: - uses: actions/checkout@v4 @@ -16,17 +16,6 @@ jobs: with: java-version: ${{ matrix.java }} distribution: temurin - - name: Set up JDK 17 - # See please https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#minimum_daemon_jvm_version - if: matrix.java == 11 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - name: Set JAVA${{ matrix.java }}_HOME - shell: bash - run: | - echo "JAVA${{ matrix.java }}_HOME=$JAVA_HOME_${{ matrix.java }}_${{ runner.arch }}" >> $GITHUB_ENV - name: Setup docker (missing on MacOS) id: setup_docker if: runner.os == 'macos' @@ -47,8 +36,8 @@ jobs: shell: bash if: runner.os != 'macos' run: | - ./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE -Druntime.java=${{ matrix.java }} + ./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE - name: Run Gradle (assemble) if: runner.os == 'macos' && steps.setup_docker.outcome == 'success' run: | - ./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE -Druntime.java=${{ matrix.java }} + ./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE diff --git a/.github/workflows/precommit.yml b/.github/workflows/precommit.yml index 572f6c981a052..917634c5e94e9 100644 --- a/.github/workflows/precommit.yml +++ b/.github/workflows/precommit.yml @@ -7,7 +7,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - java: [ 11, 17, 21, 23 ] + java: [ 21, 23 ] os: [ubuntu-latest, windows-latest, macos-latest, macos-13] steps: - uses: actions/checkout@v4 @@ -17,18 +17,7 @@ jobs: java-version: ${{ matrix.java }} distribution: temurin cache: gradle - - name: Set up JDK 17 - # See please https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#minimum_daemon_jvm_version - if: matrix.java == 11 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - name: Set JAVA${{ matrix.java }}_HOME - shell: bash - run: | - echo "JAVA${{ matrix.java }}_HOME=$JAVA_HOME_${{ matrix.java }}_${{ runner.arch }}" >> $GITHUB_ENV - name: Run Gradle (precommit) shell: bash run: | - ./gradlew javadoc precommit --parallel -Druntime.java=${{ matrix.java }} + ./gradlew javadoc precommit --parallel diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index aaa1d8bdef85c..35c0ba897fd53 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -171,8 +171,8 @@ if (project != rootProject) { allprojects { java { - targetCompatibility = JavaVersion.VERSION_11 - sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_21 } } diff --git a/buildSrc/reaper/build.gradle b/buildSrc/reaper/build.gradle index 58d06b02e9f4b..55efcf5d5dfff 100644 --- a/buildSrc/reaper/build.gradle +++ b/buildSrc/reaper/build.gradle @@ -12,8 +12,8 @@ apply plugin: 'java' java { - targetCompatibility = JavaVersion.VERSION_11 - sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_21 } jar { diff --git a/buildSrc/src/testKit/thirdPartyAudit/build.gradle b/buildSrc/src/testKit/thirdPartyAudit/build.gradle index 553ff5d8e6ed2..caaaa6bd1aceb 100644 --- a/buildSrc/src/testKit/thirdPartyAudit/build.gradle +++ b/buildSrc/src/testKit/thirdPartyAudit/build.gradle @@ -46,11 +46,11 @@ dependencies { } tasks.register("empty", ThirdPartyAuditTask) { - targetCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_21 signatureFile = file('third-party-audit-empty.txt') } tasks.register("absurd", ThirdPartyAuditTask) { - targetCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_21 signatureFile = file('third-party-audit-absurd.txt') } diff --git a/buildSrc/version.properties b/buildSrc/version.properties index 5740c124910b9..774183e12f3ac 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -1,5 +1,5 @@ opensearch = 3.0.0 -lucene = 9.12.0 +lucene = 10.0.0 bundled_jdk_vendor = adoptium bundled_jdk = 23+37 diff --git a/libs/core/licenses/lucene-core-10.0.0.jar.sha1 b/libs/core/licenses/lucene-core-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..96cc85a5c56a2 --- /dev/null +++ b/libs/core/licenses/lucene-core-10.0.0.jar.sha1 @@ -0,0 +1 @@ +5a9b3f728041df5b054aaaed3c3fd7ff0fed8ee7 \ No newline at end of file diff --git a/libs/core/licenses/lucene-core-9.12.0.jar.sha1 b/libs/core/licenses/lucene-core-9.12.0.jar.sha1 deleted file mode 100644 index e55f896dedb63..0000000000000 --- a/libs/core/licenses/lucene-core-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fdb055d569bb20bfce9618fe2b01c29bab7f290c \ No newline at end of file diff --git a/libs/core/src/main/java/org/opensearch/LegacyESVersion.java b/libs/core/src/main/java/org/opensearch/LegacyESVersion.java index 5d8e067a8fd8b..6de19c89053ad 100644 --- a/libs/core/src/main/java/org/opensearch/LegacyESVersion.java +++ b/libs/core/src/main/java/org/opensearch/LegacyESVersion.java @@ -50,7 +50,7 @@ public class LegacyESVersion extends Version { public static final LegacyESVersion V_6_0_0 = new LegacyESVersion(6000099, org.apache.lucene.util.Version.fromBits(7, 0, 0)); public static final LegacyESVersion V_6_5_0 = new LegacyESVersion(6050099, org.apache.lucene.util.Version.fromBits(7, 0, 0)); - public static final LegacyESVersion V_7_2_0 = new LegacyESVersion(7020099, org.apache.lucene.util.Version.LUCENE_8_0_0); + public static final LegacyESVersion V_7_2_0 = new LegacyESVersion(7020099, org.apache.lucene.util.Version.fromBits(8, 0, 0)); // todo move back to Version.java if retiring legacy version support protected static final Map idToVersion; diff --git a/libs/core/src/main/java/org/opensearch/Version.java b/libs/core/src/main/java/org/opensearch/Version.java index 6b1f6898eec9b..c5afcd35a8e74 100644 --- a/libs/core/src/main/java/org/opensearch/Version.java +++ b/libs/core/src/main/java/org/opensearch/Version.java @@ -112,7 +112,7 @@ public class Version implements Comparable, ToXContentFragment { public static final Version V_2_17_1 = new Version(2170199, org.apache.lucene.util.Version.LUCENE_9_11_1); public static final Version V_2_17_2 = new Version(2170299, org.apache.lucene.util.Version.LUCENE_9_11_1); public static final Version V_2_18_0 = new Version(2180099, org.apache.lucene.util.Version.LUCENE_9_12_0); - public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_12_0); + public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_10_0_0); public static final Version CURRENT = V_3_0_0; public static Version fromId(int id) { diff --git a/modules/lang-expression/licenses/lucene-expressions-10.0.0.jar.sha1 b/modules/lang-expression/licenses/lucene-expressions-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..ee70628a05318 --- /dev/null +++ b/modules/lang-expression/licenses/lucene-expressions-10.0.0.jar.sha1 @@ -0,0 +1 @@ +89b26348ec305598fc224cc9583939564b67b2cf \ No newline at end of file diff --git a/modules/lang-expression/licenses/lucene-expressions-9.12.0.jar.sha1 b/modules/lang-expression/licenses/lucene-expressions-9.12.0.jar.sha1 deleted file mode 100644 index 476049a66cc08..0000000000000 --- a/modules/lang-expression/licenses/lucene-expressions-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -5ba843374a0aab3dfe0b11cb28b251844d85bf5b \ No newline at end of file diff --git a/plugins/analysis-icu/licenses/lucene-analysis-icu-10.0.0.jar.sha1 b/plugins/analysis-icu/licenses/lucene-analysis-icu-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..058ece7137757 --- /dev/null +++ b/plugins/analysis-icu/licenses/lucene-analysis-icu-10.0.0.jar.sha1 @@ -0,0 +1 @@ +082c38c1335c069a73622c37ca3d39e64c1b2d33 \ No newline at end of file diff --git a/plugins/analysis-icu/licenses/lucene-analysis-icu-9.12.0.jar.sha1 b/plugins/analysis-icu/licenses/lucene-analysis-icu-9.12.0.jar.sha1 deleted file mode 100644 index 31398b27708a3..0000000000000 --- a/plugins/analysis-icu/licenses/lucene-analysis-icu-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -a9232b6a4882979118d3281b98dfdb6e0e1cb5ca \ No newline at end of file diff --git a/plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-10.0.0.jar.sha1 b/plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..7948076b1413a --- /dev/null +++ b/plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-10.0.0.jar.sha1 @@ -0,0 +1 @@ +26071742008630779523d08c0b46b2f371ef23a0 \ No newline at end of file diff --git a/plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-9.12.0.jar.sha1 b/plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-9.12.0.jar.sha1 deleted file mode 100644 index fa4c9d2d09d6e..0000000000000 --- a/plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -a3a6950ffc22e76a082e1b3cefb022b9f7870d29 \ No newline at end of file diff --git a/plugins/analysis-nori/licenses/lucene-analysis-nori-10.0.0.jar.sha1 b/plugins/analysis-nori/licenses/lucene-analysis-nori-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..ed21c354a6ea1 --- /dev/null +++ b/plugins/analysis-nori/licenses/lucene-analysis-nori-10.0.0.jar.sha1 @@ -0,0 +1 @@ +4a6ff02a1bd34a3c0165da05f714bb8188074bdc \ No newline at end of file diff --git a/plugins/analysis-nori/licenses/lucene-analysis-nori-9.12.0.jar.sha1 b/plugins/analysis-nori/licenses/lucene-analysis-nori-9.12.0.jar.sha1 deleted file mode 100644 index 576b924286d2d..0000000000000 --- a/plugins/analysis-nori/licenses/lucene-analysis-nori-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e71f85b72ed3939039ba8897b28b065dd11918b9 \ No newline at end of file diff --git a/plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-10.0.0.jar.sha1 b/plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..3c82cd3de2aca --- /dev/null +++ b/plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-10.0.0.jar.sha1 @@ -0,0 +1 @@ +4c488697df5038a78e5e65bb9b6da120af62d824 \ No newline at end of file diff --git a/plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-9.12.0.jar.sha1 b/plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-9.12.0.jar.sha1 deleted file mode 100644 index c8c146bbd0d25..0000000000000 --- a/plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -6baa3ae7ab20d6e644cf0bedb271c50a44c0e259 \ No newline at end of file diff --git a/plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-10.0.0.jar.sha1 b/plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..a1682a17383d5 --- /dev/null +++ b/plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-10.0.0.jar.sha1 @@ -0,0 +1 @@ +1137b9846ec000b49c70c3fe5f8cd79b7129be22 \ No newline at end of file diff --git a/plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-9.12.0.jar.sha1 b/plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-9.12.0.jar.sha1 deleted file mode 100644 index 54ea0b19f2a7b..0000000000000 --- a/plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -f183e1e8b1eaaa4dec444774a285bb8b66518522 \ No newline at end of file diff --git a/plugins/analysis-stempel/licenses/lucene-analysis-stempel-10.0.0.jar.sha1 b/plugins/analysis-stempel/licenses/lucene-analysis-stempel-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..f9abb518f0000 --- /dev/null +++ b/plugins/analysis-stempel/licenses/lucene-analysis-stempel-10.0.0.jar.sha1 @@ -0,0 +1 @@ +3fd86db5e9748063369db4bed84f1bd2ca62d387 \ No newline at end of file diff --git a/plugins/analysis-stempel/licenses/lucene-analysis-stempel-9.12.0.jar.sha1 b/plugins/analysis-stempel/licenses/lucene-analysis-stempel-9.12.0.jar.sha1 deleted file mode 100644 index 5442a40f5bba2..0000000000000 --- a/plugins/analysis-stempel/licenses/lucene-analysis-stempel-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -b81a609934e65d12ab9d2d84bc2ea6f56a360e57 \ No newline at end of file diff --git a/plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-10.0.0.jar.sha1 b/plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..f8a7e894dc05f --- /dev/null +++ b/plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-10.0.0.jar.sha1 @@ -0,0 +1 @@ +4e6b940b3b934d6de174fedaaeaefd647698648d \ No newline at end of file diff --git a/plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-9.12.0.jar.sha1 b/plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-9.12.0.jar.sha1 deleted file mode 100644 index 60fd4015cfde0..0000000000000 --- a/plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -bec069f286b45f20b743c81e84202369cd0467e7 \ No newline at end of file diff --git a/server/licenses/lucene-analysis-common-10.0.0.jar.sha1 b/server/licenses/lucene-analysis-common-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..fd1abb6a867bc --- /dev/null +++ b/server/licenses/lucene-analysis-common-10.0.0.jar.sha1 @@ -0,0 +1 @@ +13eb016bab14973158554a2e6cdf2abbc5c3eda1 \ No newline at end of file diff --git a/server/licenses/lucene-analysis-common-9.12.0.jar.sha1 b/server/licenses/lucene-analysis-common-9.12.0.jar.sha1 deleted file mode 100644 index fd952034f3742..0000000000000 --- a/server/licenses/lucene-analysis-common-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -4c2503cfaba37249e20ea877555cb52ee89d1ae1 \ No newline at end of file diff --git a/server/licenses/lucene-backward-codecs-10.0.0.jar.sha1 b/server/licenses/lucene-backward-codecs-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..640543c4c5ec0 --- /dev/null +++ b/server/licenses/lucene-backward-codecs-10.0.0.jar.sha1 @@ -0,0 +1 @@ +8e21f708eb1bbb71ce79cbfea093b6ca913f4abf \ No newline at end of file diff --git a/server/licenses/lucene-backward-codecs-9.12.0.jar.sha1 b/server/licenses/lucene-backward-codecs-9.12.0.jar.sha1 deleted file mode 100644 index 2993134edd610..0000000000000 --- a/server/licenses/lucene-backward-codecs-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -68fe98c94e9644a584ea1bf525e68d9406fc61ec \ No newline at end of file diff --git a/server/licenses/lucene-core-10.0.0.jar.sha1 b/server/licenses/lucene-core-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..96cc85a5c56a2 --- /dev/null +++ b/server/licenses/lucene-core-10.0.0.jar.sha1 @@ -0,0 +1 @@ +5a9b3f728041df5b054aaaed3c3fd7ff0fed8ee7 \ No newline at end of file diff --git a/server/licenses/lucene-core-9.12.0.jar.sha1 b/server/licenses/lucene-core-9.12.0.jar.sha1 deleted file mode 100644 index e55f896dedb63..0000000000000 --- a/server/licenses/lucene-core-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fdb055d569bb20bfce9618fe2b01c29bab7f290c \ No newline at end of file diff --git a/server/licenses/lucene-grouping-10.0.0.jar.sha1 b/server/licenses/lucene-grouping-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..178d7c5896031 --- /dev/null +++ b/server/licenses/lucene-grouping-10.0.0.jar.sha1 @@ -0,0 +1 @@ +17145d786d31e7ecd68d149ccc3e7ab83270f282 \ No newline at end of file diff --git a/server/licenses/lucene-grouping-9.12.0.jar.sha1 b/server/licenses/lucene-grouping-9.12.0.jar.sha1 deleted file mode 100644 index 48388974bb38f..0000000000000 --- a/server/licenses/lucene-grouping-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -ccf99f8db57aa97b2c1f95c5cc2a11156a043921 \ No newline at end of file diff --git a/server/licenses/lucene-highlighter-10.0.0.jar.sha1 b/server/licenses/lucene-highlighter-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..808bd4177fa7c --- /dev/null +++ b/server/licenses/lucene-highlighter-10.0.0.jar.sha1 @@ -0,0 +1 @@ +b8324f1b859620912c186b27d9666215ce3d258b \ No newline at end of file diff --git a/server/licenses/lucene-highlighter-9.12.0.jar.sha1 b/server/licenses/lucene-highlighter-9.12.0.jar.sha1 deleted file mode 100644 index 3d457579da892..0000000000000 --- a/server/licenses/lucene-highlighter-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e93429f66fbcd3b58d81f01223d6ce5688047296 \ No newline at end of file diff --git a/server/licenses/lucene-join-10.0.0.jar.sha1 b/server/licenses/lucene-join-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..cb3fcc7dacb41 --- /dev/null +++ b/server/licenses/lucene-join-10.0.0.jar.sha1 @@ -0,0 +1 @@ +3a4c5bf84c855b011e740f30cb8a23f2ee85e1c1 \ No newline at end of file diff --git a/server/licenses/lucene-join-9.12.0.jar.sha1 b/server/licenses/lucene-join-9.12.0.jar.sha1 deleted file mode 100644 index c5f6d16598a60..0000000000000 --- a/server/licenses/lucene-join-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -14c802d6955eaf11107375a2ada8fe8ec53b3e01 \ No newline at end of file diff --git a/server/licenses/lucene-memory-10.0.0.jar.sha1 b/server/licenses/lucene-memory-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..0b2cdc53ccd97 --- /dev/null +++ b/server/licenses/lucene-memory-10.0.0.jar.sha1 @@ -0,0 +1 @@ +bc0f37a0a06b445555d07e5fe199d73436d51352 \ No newline at end of file diff --git a/server/licenses/lucene-memory-9.12.0.jar.sha1 b/server/licenses/lucene-memory-9.12.0.jar.sha1 deleted file mode 100644 index e7ac44089c006..0000000000000 --- a/server/licenses/lucene-memory-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -ffe090339540876b40df792aee51a42af6b3f37f \ No newline at end of file diff --git a/server/licenses/lucene-misc-10.0.0.jar.sha1 b/server/licenses/lucene-misc-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..10d6a7e729e99 --- /dev/null +++ b/server/licenses/lucene-misc-10.0.0.jar.sha1 @@ -0,0 +1 @@ +5f619b32c62bb9405e7af595cf7311113ed62e33 \ No newline at end of file diff --git a/server/licenses/lucene-misc-9.12.0.jar.sha1 b/server/licenses/lucene-misc-9.12.0.jar.sha1 deleted file mode 100644 index afb546be4e032..0000000000000 --- a/server/licenses/lucene-misc-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -ad17704ee90eb926b6d3105f7027485cdadbecd9 \ No newline at end of file diff --git a/server/licenses/lucene-queries-10.0.0.jar.sha1 b/server/licenses/lucene-queries-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..dbc47789c752b --- /dev/null +++ b/server/licenses/lucene-queries-10.0.0.jar.sha1 @@ -0,0 +1 @@ +3d2f98787e27e8e2a65d994c86563edf16dd92f1 \ No newline at end of file diff --git a/server/licenses/lucene-queries-9.12.0.jar.sha1 b/server/licenses/lucene-queries-9.12.0.jar.sha1 deleted file mode 100644 index e24756e38dad2..0000000000000 --- a/server/licenses/lucene-queries-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -3ac2a62b0b55c5725bb65f0c5454f9f8a401cf43 \ No newline at end of file diff --git a/server/licenses/lucene-queryparser-10.0.0.jar.sha1 b/server/licenses/lucene-queryparser-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..3d91eddfd0cb7 --- /dev/null +++ b/server/licenses/lucene-queryparser-10.0.0.jar.sha1 @@ -0,0 +1 @@ +e11886c913058ef20378715dee715d942d04babc \ No newline at end of file diff --git a/server/licenses/lucene-queryparser-9.12.0.jar.sha1 b/server/licenses/lucene-queryparser-9.12.0.jar.sha1 deleted file mode 100644 index e93e00a063dd0..0000000000000 --- a/server/licenses/lucene-queryparser-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -55959399373876f4c184944315458dc6b88fbd81 \ No newline at end of file diff --git a/server/licenses/lucene-sandbox-10.0.0.jar.sha1 b/server/licenses/lucene-sandbox-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..017398715a38f --- /dev/null +++ b/server/licenses/lucene-sandbox-10.0.0.jar.sha1 @@ -0,0 +1 @@ +1795ce5b066bda61483c375f6b8e358aaa4f6348 \ No newline at end of file diff --git a/server/licenses/lucene-sandbox-9.12.0.jar.sha1 b/server/licenses/lucene-sandbox-9.12.0.jar.sha1 deleted file mode 100644 index a3fd8446e0dbc..0000000000000 --- a/server/licenses/lucene-sandbox-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -f65882536d681c11a1cbc920e5679201101e3603 \ No newline at end of file diff --git a/server/licenses/lucene-spatial-extras-10.0.0.jar.sha1 b/server/licenses/lucene-spatial-extras-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..320c07f51fbaa --- /dev/null +++ b/server/licenses/lucene-spatial-extras-10.0.0.jar.sha1 @@ -0,0 +1 @@ +a701eb363cf0a75ebacd1844398314250abcf592 \ No newline at end of file diff --git a/server/licenses/lucene-spatial-extras-9.12.0.jar.sha1 b/server/licenses/lucene-spatial-extras-9.12.0.jar.sha1 deleted file mode 100644 index b0f11fb667faf..0000000000000 --- a/server/licenses/lucene-spatial-extras-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -9d00cc7cc2279822ef6740f0677cafacfb439fa8 \ No newline at end of file diff --git a/server/licenses/lucene-spatial3d-10.0.0.jar.sha1 b/server/licenses/lucene-spatial3d-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..059721a317028 --- /dev/null +++ b/server/licenses/lucene-spatial3d-10.0.0.jar.sha1 @@ -0,0 +1 @@ +d9e0a8a6084d7657a633c1aa94d750414f5288c4 \ No newline at end of file diff --git a/server/licenses/lucene-spatial3d-9.12.0.jar.sha1 b/server/licenses/lucene-spatial3d-9.12.0.jar.sha1 deleted file mode 100644 index 858eee25ac191..0000000000000 --- a/server/licenses/lucene-spatial3d-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e3092632ca1d4427d3ebb2c866ac89d90f5b61ec \ No newline at end of file diff --git a/server/licenses/lucene-suggest-10.0.0.jar.sha1 b/server/licenses/lucene-suggest-10.0.0.jar.sha1 new file mode 100644 index 0000000000000..72db888179d00 --- /dev/null +++ b/server/licenses/lucene-suggest-10.0.0.jar.sha1 @@ -0,0 +1 @@ +d79099abc148a1906e129abbabd5e1b18a20c117 \ No newline at end of file diff --git a/server/licenses/lucene-suggest-9.12.0.jar.sha1 b/server/licenses/lucene-suggest-9.12.0.jar.sha1 deleted file mode 100644 index 973a7726d845d..0000000000000 --- a/server/licenses/lucene-suggest-9.12.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e1c6636499317ebe498f3490a1ec8b86b8a363dd \ No newline at end of file diff --git a/server/src/main/java/org/apache/lucene/search/grouping/CollapseTopFieldDocs.java b/server/src/main/java/org/apache/lucene/search/grouping/CollapseTopFieldDocs.java index 961587113173d..4ab1eee4e089f 100644 --- a/server/src/main/java/org/apache/lucene/search/grouping/CollapseTopFieldDocs.java +++ b/server/src/main/java/org/apache/lucene/search/grouping/CollapseTopFieldDocs.java @@ -192,10 +192,10 @@ public static CollapseTopFieldDocs merge(Sort sort, int start, int size, Collaps final CollapseTopFieldDocs shard = shardHits[shardIDX]; // totalHits can be non-zero even if no hits were // collected, when searchAfter was used: - totalHitCount += shard.totalHits.value; + totalHitCount += shard.totalHits.value(); // If any hit count is a lower bound then the merged // total hit count is a lower bound as well - if (shard.totalHits.relation == TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO) { + if (shard.totalHits.relation() == TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO) { totalHitsRelation = TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO; } if (CollectionUtils.isEmpty(shard.scoreDocs) == false) { diff --git a/server/src/main/java/org/apache/lucene/search/grouping/CollapsingDocValuesSource.java b/server/src/main/java/org/apache/lucene/search/grouping/CollapsingDocValuesSource.java index d747bb47a30ad..661ab1374bd28 100644 --- a/server/src/main/java/org/apache/lucene/search/grouping/CollapsingDocValuesSource.java +++ b/server/src/main/java/org/apache/lucene/search/grouping/CollapsingDocValuesSource.java @@ -229,7 +229,7 @@ public void setNextReader(LeafReaderContext readerContext) throws IOException { public boolean advanceExact(int target) throws IOException { if (sorted.advanceExact(target)) { ord = (int) sorted.nextOrd(); - if (sorted.nextOrd() != SortedSetDocValues.NO_MORE_ORDS) { + if (sorted.nextOrd() != SortedSetDocValues.NO_MORE_DOCS) { throw new IllegalStateException( "failed to collapse " + target + ", the collapse field must be single valued" ); diff --git a/server/src/main/java/org/apache/lucene/util/packed/XPackedInts.java b/server/src/main/java/org/apache/lucene/util/packed/XPackedInts.java index 4260d34ead7c9..4d45485ce2f7c 100644 --- a/server/src/main/java/org/apache/lucene/util/packed/XPackedInts.java +++ b/server/src/main/java/org/apache/lucene/util/packed/XPackedInts.java @@ -534,7 +534,7 @@ public static Reader getDirectReader(IndexInput in) throws IOException { */ public static Mutable getMutable(int valueCount, int bitsPerValue, float acceptableOverheadRatio) { final FormatAndBits formatAndBits = fastestFormatAndBits(valueCount, bitsPerValue, acceptableOverheadRatio); - return getMutable(valueCount, formatAndBits.bitsPerValue, formatAndBits.format); + return getMutable(valueCount, formatAndBits.bitsPerValue(), formatAndBits.format()); } /** @@ -629,7 +629,13 @@ public static Writer getWriter(DataOutput out, int valueCount, int bitsPerValue, assert valueCount >= 0; final FormatAndBits formatAndBits = fastestFormatAndBits(valueCount, bitsPerValue, acceptableOverheadRatio); - final XWriter writer = getWriterNoHeader(out, formatAndBits.format, valueCount, formatAndBits.bitsPerValue, DEFAULT_BUFFER_SIZE); + final XWriter writer = getWriterNoHeader( + out, + formatAndBits.format(), + valueCount, + formatAndBits.bitsPerValue(), + DEFAULT_BUFFER_SIZE + ); writer.writeHeader(); return writer; } diff --git a/server/src/main/java/org/opensearch/index/codec/CodecService.java b/server/src/main/java/org/opensearch/index/codec/CodecService.java index 3a93795ef61ec..fe672444c46a9 100644 --- a/server/src/main/java/org/opensearch/index/codec/CodecService.java +++ b/server/src/main/java/org/opensearch/index/codec/CodecService.java @@ -34,8 +34,8 @@ import org.apache.logging.log4j.Logger; import org.apache.lucene.codecs.Codec; -import org.apache.lucene.codecs.lucene912.Lucene912Codec; -import org.apache.lucene.codecs.lucene912.Lucene912Codec.Mode; +import org.apache.lucene.codecs.lucene100.Lucene100Codec; +import org.apache.lucene.codecs.lucene100.Lucene100Codec.Mode; import org.opensearch.common.Nullable; import org.opensearch.common.collect.MapBuilder; import org.opensearch.index.IndexSettings; @@ -70,10 +70,10 @@ public CodecService(@Nullable MapperService mapperService, IndexSettings indexSe final MapBuilder codecs = MapBuilder.newMapBuilder(); assert null != indexSettings; if (mapperService == null) { - codecs.put(DEFAULT_CODEC, new Lucene912Codec()); - codecs.put(LZ4, new Lucene912Codec()); - codecs.put(BEST_COMPRESSION_CODEC, new Lucene912Codec(Mode.BEST_COMPRESSION)); - codecs.put(ZLIB, new Lucene912Codec(Mode.BEST_COMPRESSION)); + codecs.put(DEFAULT_CODEC, new Lucene100Codec()); + codecs.put(LZ4, new Lucene100Codec()); + codecs.put(BEST_COMPRESSION_CODEC, new Lucene100Codec(Mode.BEST_COMPRESSION)); + codecs.put(ZLIB, new Lucene100Codec(Mode.BEST_COMPRESSION)); } else { // CompositeCodec still delegates to PerFieldMappingPostingFormatCodec // We can still support all the compression codecs when composite index is present diff --git a/server/src/main/java/org/opensearch/index/codec/PerFieldMappingPostingFormatCodec.java b/server/src/main/java/org/opensearch/index/codec/PerFieldMappingPostingFormatCodec.java index 0ed8c3880f2ea..e795d80279d2c 100644 --- a/server/src/main/java/org/opensearch/index/codec/PerFieldMappingPostingFormatCodec.java +++ b/server/src/main/java/org/opensearch/index/codec/PerFieldMappingPostingFormatCodec.java @@ -36,8 +36,8 @@ import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.DocValuesFormat; import org.apache.lucene.codecs.PostingsFormat; +import org.apache.lucene.codecs.lucene100.Lucene100Codec; import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat; -import org.apache.lucene.codecs.lucene912.Lucene912Codec; import org.opensearch.common.lucene.Lucene; import org.opensearch.index.codec.fuzzy.FuzzyFilterPostingsFormat; import org.opensearch.index.codec.fuzzy.FuzzySetFactory; @@ -59,7 +59,7 @@ * * @opensearch.internal */ -public class PerFieldMappingPostingFormatCodec extends Lucene912Codec { +public class PerFieldMappingPostingFormatCodec extends Lucene100Codec { private final Logger logger; private final MapperService mapperService; private final DocValuesFormat dvFormat = new Lucene90DocValuesFormat(); diff --git a/server/src/main/java/org/opensearch/index/fielddata/FieldData.java b/server/src/main/java/org/opensearch/index/fielddata/FieldData.java index 6db6bbccacae5..e91dc7a5045ab 100644 --- a/server/src/main/java/org/opensearch/index/fielddata/FieldData.java +++ b/server/src/main/java/org/opensearch/index/fielddata/FieldData.java @@ -435,7 +435,7 @@ public boolean advanceExact(int doc) throws IOException { return false; } for (int i = 0;; ++i) { - if (values.nextOrd() == SortedSetDocValues.NO_MORE_ORDS) { + if (values.nextOrd() == SortedSetDocValues.NO_MORE_DOCS) { count = i; break; } diff --git a/server/src/main/java/org/opensearch/index/fielddata/ordinals/GlobalOrdinalMapping.java b/server/src/main/java/org/opensearch/index/fielddata/ordinals/GlobalOrdinalMapping.java index cc5415aacd276..bd2ce5c100ae4 100644 --- a/server/src/main/java/org/opensearch/index/fielddata/ordinals/GlobalOrdinalMapping.java +++ b/server/src/main/java/org/opensearch/index/fielddata/ordinals/GlobalOrdinalMapping.java @@ -77,8 +77,8 @@ public boolean advanceExact(int target) throws IOException { @Override public long nextOrd() throws IOException { long segmentOrd = values.nextOrd(); - if (segmentOrd == SortedSetDocValues.NO_MORE_ORDS) { - return SortedSetDocValues.NO_MORE_ORDS; + if (segmentOrd == SortedSetDocValues.NO_MORE_DOCS) { + return SortedSetDocValues.NO_MORE_DOCS; } else { return getGlobalOrd(segmentOrd); } diff --git a/server/src/main/java/org/opensearch/index/fielddata/ordinals/MultiOrdinals.java b/server/src/main/java/org/opensearch/index/fielddata/ordinals/MultiOrdinals.java index daccb5dfe9fca..ea91e6ddd1820 100644 --- a/server/src/main/java/org/opensearch/index/fielddata/ordinals/MultiOrdinals.java +++ b/server/src/main/java/org/opensearch/index/fielddata/ordinals/MultiOrdinals.java @@ -68,13 +68,13 @@ public static boolean significantlySmallerThanSinglePackedOrdinals( float acceptableOverheadRatio ) { int bitsPerOrd = PackedInts.bitsRequired(numOrds); - bitsPerOrd = PackedInts.fastestFormatAndBits(numDocsWithValue, bitsPerOrd, acceptableOverheadRatio).bitsPerValue; + bitsPerOrd = PackedInts.fastestFormatAndBits(numDocsWithValue, bitsPerOrd, acceptableOverheadRatio).bitsPerValue(); // Compute the worst-case number of bits per value for offsets in the worst case, eg. if no docs have a value at the // beginning of the block and all docs have one at the end of the block final float avgValuesPerDoc = (float) numDocsWithValue / maxDoc; final int maxDelta = (int) Math.ceil(OFFSETS_PAGE_SIZE * (1 - avgValuesPerDoc) * avgValuesPerDoc); int bitsPerOffset = PackedInts.bitsRequired(maxDelta) + 1; // +1 because of the sign - bitsPerOffset = PackedInts.fastestFormatAndBits(maxDoc, bitsPerOffset, acceptableOverheadRatio).bitsPerValue; + bitsPerOffset = PackedInts.fastestFormatAndBits(maxDoc, bitsPerOffset, acceptableOverheadRatio).bitsPerValue(); final long expectedMultiSizeInBytes = (long) numDocsWithValue * bitsPerOrd + (long) maxDoc * bitsPerOffset; final long expectedSingleSizeInBytes = (long) maxDoc * bitsPerOrd; @@ -219,7 +219,7 @@ public boolean advanceExact(int docId) throws IOException { @Override public long nextOrd() throws IOException { if (currentOffset == currentEndOffset) { - return SortedSetDocValues.NO_MORE_ORDS; + return SortedSetDocValues.NO_MORE_DOCS; } else { return ords.get(currentOffset++); } diff --git a/server/src/main/java/org/opensearch/index/get/ShardGetService.java b/server/src/main/java/org/opensearch/index/get/ShardGetService.java index d4eeb8aae8e24..082a06c8f7773 100644 --- a/server/src/main/java/org/opensearch/index/get/ShardGetService.java +++ b/server/src/main/java/org/opensearch/index/get/ShardGetService.java @@ -32,6 +32,7 @@ package org.opensearch.index.get; +import org.apache.lucene.index.DocValuesSkipIndexType; import org.apache.lucene.index.DocValuesType; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.IndexOptions; @@ -323,6 +324,7 @@ private GetResult innerGetLoadFromStoredFields( false, IndexOptions.NONE, DocValuesType.NONE, + DocValuesSkipIndexType.NONE, -1, Collections.emptyMap(), 0, diff --git a/server/src/main/java/org/opensearch/index/mapper/WildcardFieldMapper.java b/server/src/main/java/org/opensearch/index/mapper/WildcardFieldMapper.java index e43e3bda692e7..c10e96d5f5f07 100644 --- a/server/src/main/java/org/opensearch/index/mapper/WildcardFieldMapper.java +++ b/server/src/main/java/org/opensearch/index/mapper/WildcardFieldMapper.java @@ -37,6 +37,7 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.Automaton; import org.apache.lucene.util.automaton.CompiledAutomaton; +import org.apache.lucene.util.automaton.Operations; import org.apache.lucene.util.automaton.RegExp; import org.opensearch.common.lucene.BytesRefs; import org.opensearch.common.lucene.Lucene; @@ -430,7 +431,7 @@ public Query wildcardQuery(String value, MultiTermQuery.RewriteMethod method, bo finalValue = value; } Predicate matchPredicate; - Automaton automaton = WildcardQuery.toAutomaton(new Term(name(), finalValue)); + Automaton automaton = WildcardQuery.toAutomaton(new Term(name(), finalValue), Operations.DEFAULT_DETERMINIZE_WORK_LIMIT); CompiledAutomaton compiledAutomaton = new CompiledAutomaton(automaton); if (compiledAutomaton.type == CompiledAutomaton.AUTOMATON_TYPE.SINGLE) { // when type equals SINGLE, #compiledAutomaton.runAutomaton is null @@ -573,7 +574,7 @@ public Query regexpQuery( } RegExp regExp = new RegExp(value, syntaxFlags, matchFlags); - Automaton automaton = regExp.toAutomaton(maxDeterminizedStates); + Automaton automaton = regExp.toAutomaton(); CompiledAutomaton compiledAutomaton = new CompiledAutomaton(automaton); Predicate regexpPredicate; @@ -650,7 +651,7 @@ private static Query regexpToQuery(String fieldName, RegExp regExp) { return new MatchAllDocsQuery(); } if (query.clauses().size() == 1) { - return query.iterator().next().getQuery(); + return query.iterator().next().query(); } else if (query.clauses().size() == 0) { return new MatchAllDocsQuery(); } @@ -804,18 +805,8 @@ public Query rewrite(IndexSearcher indexSearcher) throws IOException { public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException { Weight firstPhaseWeight = firstPhaseQuery.createWeight(searcher, scoreMode, boost); return new ConstantScoreWeight(this, boost) { - @Override - public Scorer scorer(LeafReaderContext leafReaderContext) throws IOException { - ScorerSupplier supplier = scorerSupplier(leafReaderContext); - if (supplier == null) { - return null; - } - return supplier.get(Long.MAX_VALUE); - } - @Override public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOException { - Weight weight = this; ScorerSupplier firstPhaseSupplier = firstPhaseWeight.scorerSupplier(context); if (firstPhaseSupplier == null) { return null; @@ -846,7 +837,7 @@ public float matchCost() { return MATCH_COST_ESTIMATE; } }; - return new ConstantScoreScorer(weight, score(), scoreMode, twoPhaseIterator); + return new ConstantScoreScorer(score(), scoreMode, twoPhaseIterator); } @Override diff --git a/server/src/main/java/org/opensearch/index/query/RegexpFlag.java b/server/src/main/java/org/opensearch/index/query/RegexpFlag.java index b7e7569f67127..f5eb1ebc98d04 100644 --- a/server/src/main/java/org/opensearch/index/query/RegexpFlag.java +++ b/server/src/main/java/org/opensearch/index/query/RegexpFlag.java @@ -63,7 +63,7 @@ public enum RegexpFlag { /** * Enables complement expression of the form: {@code ~<expression>} */ - COMPLEMENT(RegExp.COMPLEMENT), + COMPLEMENT(RegExp.DEPRECATED_COMPLEMENT), /** * Enables empty language expression: {@code #} diff --git a/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java b/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java index 94c25202ac90c..93afe429c3d04 100644 --- a/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java +++ b/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java @@ -127,7 +127,7 @@ private static FileCachedIndexInput createIndexInput(FileCache fileCache, Stream } } } - final IndexInput luceneIndexInput = request.getDirectory().openInput(request.getFileName(), IOContext.READ); + final IndexInput luceneIndexInput = request.getDirectory().openInput(request.getFileName(), IOContext.DEFAULT); return new FileCachedIndexInput(fileCache, request.getFilePath(), luceneIndexInput); } catch (IOException e) { throw new UncheckedIOException(e); diff --git a/server/src/main/java/org/opensearch/search/MultiValueMode.java b/server/src/main/java/org/opensearch/search/MultiValueMode.java index a99da674836f2..9595dfab0e41f 100644 --- a/server/src/main/java/org/opensearch/search/MultiValueMode.java +++ b/server/src/main/java/org/opensearch/search/MultiValueMode.java @@ -505,7 +505,7 @@ protected BytesRef pick( @Override protected int pick(SortedSetDocValues values) throws IOException { long maxOrd = -1; - for (long ord = values.nextOrd(); ord != SortedSetDocValues.NO_MORE_ORDS; ord = values.nextOrd()) { + for (long ord = values.nextOrd(); ord != SortedSetDocValues.NO_MORE_DOCS; ord = values.nextOrd()) { maxOrd = ord; } return Math.toIntExact(maxOrd); diff --git a/server/src/main/java/org/opensearch/search/SearchHits.java b/server/src/main/java/org/opensearch/search/SearchHits.java index 8232643b353f5..963ce82e636cf 100644 --- a/server/src/main/java/org/opensearch/search/SearchHits.java +++ b/server/src/main/java/org/opensearch/search/SearchHits.java @@ -219,12 +219,12 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.startObject(Fields.HITS); boolean totalHitAsInt = params.paramAsBoolean(RestSearchAction.TOTAL_HITS_AS_INT_PARAM, false); if (totalHitAsInt) { - long total = totalHits == null ? -1 : totalHits.value; + long total = totalHits == null ? -1 : totalHits.value(); builder.field(Fields.TOTAL, total); } else if (totalHits != null) { builder.startObject(Fields.TOTAL); - builder.field("value", totalHits.value); - builder.field("relation", totalHits.relation == Relation.EQUAL_TO ? "eq" : "gte"); + builder.field("value", totalHits.value()); + builder.field("relation", totalHits.relation() == Relation.EQUAL_TO ? "eq" : "gte"); builder.endObject(); } if (Float.isNaN(maxScore)) { diff --git a/server/src/main/java/org/opensearch/search/fetch/subphase/highlight/FragmentBuilderHelper.java b/server/src/main/java/org/opensearch/search/fetch/subphase/highlight/FragmentBuilderHelper.java index e037ae5544a07..2e94a7ba0b3f6 100644 --- a/server/src/main/java/org/opensearch/search/fetch/subphase/highlight/FragmentBuilderHelper.java +++ b/server/src/main/java/org/opensearch/search/fetch/subphase/highlight/FragmentBuilderHelper.java @@ -75,13 +75,13 @@ public static WeightedFragInfo fixWeightedFragInfo(MappedFieldType fieldType, Fi CollectionUtil.introSort(subInfos, new Comparator() { @Override public int compare(SubInfo o1, SubInfo o2) { - int startOffset = o1.getTermsOffsets().get(0).getStartOffset(); - int startOffset2 = o2.getTermsOffsets().get(0).getStartOffset(); + int startOffset = o1.termsOffsets().get(0).getStartOffset(); + int startOffset2 = o2.termsOffsets().get(0).getStartOffset(); return FragmentBuilderHelper.compare(startOffset, startOffset2); } }); return new WeightedFragInfo( - Math.min(fragInfo.getSubInfos().get(0).getTermsOffsets().get(0).getStartOffset(), fragInfo.getStartOffset()), + Math.min(fragInfo.getSubInfos().get(0).termsOffsets().get(0).getStartOffset(), fragInfo.getStartOffset()), fragInfo.getEndOffset(), subInfos, fragInfo.getTotalBoost() diff --git a/server/src/main/java/org/opensearch/search/profile/query/ProfileScorer.java b/server/src/main/java/org/opensearch/search/profile/query/ProfileScorer.java index 319281449195b..28b693ee03ad5 100644 --- a/server/src/main/java/org/opensearch/search/profile/query/ProfileScorer.java +++ b/server/src/main/java/org/opensearch/search/profile/query/ProfileScorer.java @@ -35,7 +35,6 @@ import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TwoPhaseIterator; -import org.apache.lucene.search.Weight; import org.opensearch.search.profile.AbstractProfileBreakdown; import org.opensearch.search.profile.Timer; @@ -51,15 +50,12 @@ final class ProfileScorer extends Scorer { private final Scorer scorer; - private ProfileWeight profileWeight; private final Timer scoreTimer, nextDocTimer, advanceTimer, matchTimer, shallowAdvanceTimer, computeMaxScoreTimer, setMinCompetitiveScoreTimer; - ProfileScorer(ProfileWeight w, Scorer scorer, AbstractProfileBreakdown profile) throws IOException { - super(w); + ProfileScorer(Scorer scorer, AbstractProfileBreakdown profile) throws IOException { this.scorer = scorer; - this.profileWeight = w; scoreTimer = profile.getTimer(QueryTimingType.SCORE); nextDocTimer = profile.getTimer(QueryTimingType.NEXT_DOC); advanceTimer = profile.getTimer(QueryTimingType.ADVANCE); @@ -84,11 +80,6 @@ public float score() throws IOException { } } - @Override - public Weight getWeight() { - return profileWeight; - } - @Override public Collection getChildren() throws IOException { return scorer.getChildren(); diff --git a/server/src/main/java/org/opensearch/search/profile/query/ProfileWeight.java b/server/src/main/java/org/opensearch/search/profile/query/ProfileWeight.java index c7e70d8d88007..f190a9734c1a5 100644 --- a/server/src/main/java/org/opensearch/search/profile/query/ProfileWeight.java +++ b/server/src/main/java/org/opensearch/search/profile/query/ProfileWeight.java @@ -33,7 +33,6 @@ package org.opensearch.search.profile.query; import org.apache.lucene.index.LeafReaderContext; -import org.apache.lucene.search.BulkScorer; import org.apache.lucene.search.Collector; import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Query; @@ -63,15 +62,6 @@ public ProfileWeight(Query query, Weight subQueryWeight, ContextualProfileBreakd this.profile = profile; } - @Override - public Scorer scorer(LeafReaderContext context) throws IOException { - ScorerSupplier supplier = scorerSupplier(context); - if (supplier == null) { - return null; - } - return supplier.get(Long.MAX_VALUE); - } - @Override public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOException { Timer timer = profile.context(context).getTimer(QueryTimingType.BUILD_SCORER); @@ -86,14 +76,13 @@ public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOExcepti return null; } - final ProfileWeight weight = this; return new ScorerSupplier() { @Override public Scorer get(long loadCost) throws IOException { timer.start(); try { - return new ProfileScorer(weight, subQueryScorerSupplier.get(loadCost), profile.context(context)); + return new ProfileScorer(subQueryScorerSupplier.get(loadCost), profile.context(context)); } finally { timer.stop(); } @@ -111,18 +100,6 @@ public long cost() { }; } - @Override - public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { - // We use the default bulk scorer instead of the specialized one. The reason - // is that Lucene's BulkScorers do everything at once: finding matches, - // scoring them and calling the collector, so they make it impossible to - // see where time is spent, which is the purpose of query profiling. - // The default bulk scorer will pull a scorer and iterate over matches, - // this might be a significantly different execution path for some queries - // like disjunctions, but in general this is what is done anyway - return super.bulkScorer(context); - } - @Override public Explanation explain(LeafReaderContext context, int doc) throws IOException { return subQueryWeight.explain(context, doc); diff --git a/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java b/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java index f780f6fe32af2..01ac25cdd9054 100644 --- a/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java +++ b/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java @@ -581,7 +581,7 @@ TopDocsAndMaxScore newTopDocs(final TopDocs topDocs, final float maxScore, final // artificially reducing the number of total hits and doc scores. ScoreDoc[] scoreDocs = topDocs.scoreDocs; if (terminatedAfter != null) { - if (totalHits.value > terminatedAfter) { + if (totalHits.value() > terminatedAfter) { totalHits = new TotalHits(terminatedAfter, TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO); } diff --git a/server/src/main/java/org/opensearch/search/slice/DocValuesSliceQuery.java b/server/src/main/java/org/opensearch/search/slice/DocValuesSliceQuery.java index 856e103193463..3b0e981aed81a 100644 --- a/server/src/main/java/org/opensearch/search/slice/DocValuesSliceQuery.java +++ b/server/src/main/java/org/opensearch/search/slice/DocValuesSliceQuery.java @@ -90,7 +90,7 @@ public float matchCost() { return 10; } }; - return new ConstantScoreScorer(this, score(), scoreMode, twoPhase); + return new ConstantScoreScorer(score(), scoreMode, twoPhase); } @Override diff --git a/server/src/main/java/org/opensearch/search/suggest/phrase/DirectCandidateGenerator.java b/server/src/main/java/org/opensearch/search/suggest/phrase/DirectCandidateGenerator.java index 1a00cb9465771..4fa6e262e89ad 100644 --- a/server/src/main/java/org/opensearch/search/suggest/phrase/DirectCandidateGenerator.java +++ b/server/src/main/java/org/opensearch/search/suggest/phrase/DirectCandidateGenerator.java @@ -131,7 +131,7 @@ public DirectCandidateGenerator( */ @Override public boolean isKnownWord(BytesRef term) throws IOException { - return termStats(term).docFreq > 0; + return termStats(term).docFreq() > 0; } /* (non-Javadoc) @@ -173,7 +173,7 @@ public CandidateSet drawCandidates(CandidateSet set) throws IOException { because that's what {@link DirectSpellChecker#suggestSimilar} expects when filtering terms. */ - int threshold = thresholdTermFrequency(original.termStats.docFreq); + int threshold = thresholdTermFrequency(original.termStats.docFreq()); if (threshold == Integer.MAX_VALUE) { // the threshold is the max possible frequency so we can skip the search return set; @@ -267,7 +267,7 @@ public void nextToken() throws IOException { } private double score(TermStats termStats, double errorScore, long dictionarySize) { - return errorScore * (((double) termStats.totalTermFreq + 1) / ((double) dictionarySize + 1)); + return errorScore * (((double) termStats.totalTermFreq() + 1) / ((double) dictionarySize + 1)); } // package protected for test diff --git a/server/src/main/java/org/opensearch/search/suggest/phrase/LaplaceScorer.java b/server/src/main/java/org/opensearch/search/suggest/phrase/LaplaceScorer.java index 7ac1d14576ea1..2c307e9464705 100644 --- a/server/src/main/java/org/opensearch/search/suggest/phrase/LaplaceScorer.java +++ b/server/src/main/java/org/opensearch/search/suggest/phrase/LaplaceScorer.java @@ -64,7 +64,7 @@ protected double scoreUnigram(Candidate word) throws IOException { @Override protected double scoreBigram(Candidate word, Candidate w_1) throws IOException { join(separator, spare, w_1.term, word.term); - return (alpha + frequency(spare.get())) / (w_1.termStats.totalTermFreq + alpha * numTerms); + return (alpha + frequency(spare.get())) / (w_1.termStats.totalTermFreq() + alpha * numTerms); } @Override diff --git a/server/src/main/java/org/opensearch/search/suggest/phrase/LinearInterpolatingScorer.java b/server/src/main/java/org/opensearch/search/suggest/phrase/LinearInterpolatingScorer.java index e012dde78c59e..6da733e97efdd 100644 --- a/server/src/main/java/org/opensearch/search/suggest/phrase/LinearInterpolatingScorer.java +++ b/server/src/main/java/org/opensearch/search/suggest/phrase/LinearInterpolatingScorer.java @@ -86,7 +86,7 @@ protected double scoreBigram(Candidate word, Candidate w_1) throws IOException { if (count < 1) { return unigramLambda * scoreUnigram(word); } - return bigramLambda * (count / (0.5d + w_1.termStats.totalTermFreq)) + unigramLambda * scoreUnigram(word); + return bigramLambda * (count / (0.5d + w_1.termStats.totalTermFreq())) + unigramLambda * scoreUnigram(word); } @Override diff --git a/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java b/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java index e8ba90f353f02..c4b531229ae7b 100644 --- a/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java +++ b/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java @@ -98,7 +98,7 @@ public void nextToken() throws IOException { if (posIncAttr.getPositionIncrement() == 0 && typeAttribute.type() == SynonymFilter.TYPE_SYNONYM) { assert currentSet != null; TermStats termStats = generator.termStats(term); - if (termStats.docFreq > 0) { + if (termStats.docFreq() > 0) { currentSet.addOneCandidate(generator.createCandidate(BytesRef.deepCopyOf(term), termStats, realWordLikelihood)); } } else { diff --git a/server/src/main/java/org/opensearch/search/suggest/phrase/StupidBackoffScorer.java b/server/src/main/java/org/opensearch/search/suggest/phrase/StupidBackoffScorer.java index 35de07015b853..4b66eb0f10301 100644 --- a/server/src/main/java/org/opensearch/search/suggest/phrase/StupidBackoffScorer.java +++ b/server/src/main/java/org/opensearch/search/suggest/phrase/StupidBackoffScorer.java @@ -63,7 +63,7 @@ protected double scoreBigram(Candidate word, Candidate w_1) throws IOException { if (count < 1) { return discount * scoreUnigram(word); } - return count / (w_1.termStats.totalTermFreq + 0.00000000001d); + return count / (w_1.termStats.totalTermFreq() + 0.00000000001d); } @Override @@ -78,7 +78,7 @@ protected double scoreTrigram(Candidate w, Candidate w_1, Candidate w_2) throws join(separator, spare, w_2.term, w_1.term, w.term); long trigramCount = frequency(spare.get()); if (trigramCount < 1) { - return discount * (bigramCount / (w_1.termStats.totalTermFreq + 0.00000000001d)); + return discount * (bigramCount / (w_1.termStats.totalTermFreq() + 0.00000000001d)); } return trigramCount / (bigramCount + 0.00000000001d); } diff --git a/server/src/test/java/org/opensearch/indices/IndicesQueryCacheTests.java b/server/src/test/java/org/opensearch/indices/IndicesQueryCacheTests.java index ba40343fb2130..7aa07a4bdb9c6 100644 --- a/server/src/test/java/org/opensearch/indices/IndicesQueryCacheTests.java +++ b/server/src/test/java/org/opensearch/indices/IndicesQueryCacheTests.java @@ -91,10 +91,10 @@ public String toString(String field) { @Override public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException { - return new ConstantScoreWeight(this, boost) { + return new ConstantScoreWeight(boost) { @Override public Scorer scorer(LeafReaderContext context) throws IOException { - return new ConstantScoreScorer(this, score(), scoreMode, DocIdSetIterator.all(context.reader().maxDoc())); + return new ConstantScoreScorer(score(), scoreMode, DocIdSetIterator.all(context.reader().maxDoc())); } @Override