Skip to content

Support Es8.16-8.19 #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,15 @@ jobs:
strategy:
matrix:
es-version:
- 'es:8.18.3'
- 'es:8.17.8'
- 'es:8.16.6'
- 'es:8.15.2'
- 'es:8.14.3'
- 'es:8.13.4'
- 'es:8.12.2'
- 'es:8.11.4'
- 'es:8.10.4'
- 'es:8.9.2'
- 'es:8.8.2'
- 'es:8.7.1'
- 'es:8.6.2'
- 'es:8.5.3'
- 'es:8.4.3'
- 'es:8.3.3'
- 'es:8.2.3'
- 'es:7.17.24'
- 'es:7.17.8'
- 'es:7.14.2'
- 'es:7.10.2'
- 'os:2.18.0'
- 'os:2.17.1'
- 'os:2.16.0'
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Change log

## [Unreleased]
## [3.4.0](https://github.com/WorksApplications/elasticsearch-sudachi/releases/tag/v3.4.0) - 2025-08-18

### Added

- Support OpenSearch 2.18.0
- Support Elasticsearch 8.16.6, 8.17.8, and 8.18.3

### Removed
- Elasticsearch 7.x and versions earlier than 8.10 will no longer be supported.$

## [3.3.0](https://github.com/WorksApplications/elasticsearch-sudachi/releases/tag/v3.3.0) - 2024-11-13

Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,24 @@ analysis-sudachi is an Elasticsearch plugin for tokenization of Japanese text us

# What's new?

- [3.3.0]
- `allow_empty_morpheme` is added to the `sudachi_tokenizer` settings (#151)
- Offset correction of `SudachiSplitFilter` now works properly with char filters (#149)
- spi changed to implement #149
- [3.4.0]
- Support Elasticsearch 8.16.6, 8.17.8, and 8.18.3.
- Elasticsearch 7.x and versions earlier than 8.10 will no longer be supported.

Check [changelog](./CHANGELOG.md) for more.

# Build (if necessary)

1. Build analysis-sudachi.
```
$ ./gradlew -PengineVersion=es:8.15.2 build
$ ./gradlew -PengineVersion=es:8.19.2 build
```

Use `-PengineVersion=os:2.18.0` for OpenSearch.

## Supported ElasticSearch versions

1. 8.0.* until 8.15.* supported, integration tests in CI
2. 7.17.* (latest patch version) - supported, integration tests in CI
3. 7.11.* until 7.16.* - best effort support, not tested in CI
4. 7.10.* integration tests for the latest patch version
5. 7.9.* and below - not tested in CI at all, may be broken
6. 7.3.* and below - broken, not supported
1. 8.10.* until 8.19.* supported, integration tests in CI

## Supported OpenSearch versions

Expand Down
16 changes: 12 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ archivesBaseName = 'analysis-sudachi'
version = properties["pluginVersion"]

compileKotlin {
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}

compileTestKotlin {
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}

configurations {
Expand Down Expand Up @@ -52,7 +52,7 @@ dependencies {

def embedVersion = tasks.register('embedVersion', Copy) {
var esKind = sudachiEs.kind.get()
from 'src/main/extras/plugin-descriptor.properties'
from('src/main/extras') { include 'plugin-descriptor.properties' }
into "build/package/${version}/${esKind.engine.kind}-${esKind.version}"
expand([
version: version,
Expand All @@ -63,6 +63,14 @@ def embedVersion = tasks.register('embedVersion', Copy) {
inputs.property("elasticSearchVersion", esKind.version)
}

def copyPluginMeta = tasks.register('copyPluginMeta', Copy) {
var esKind = sudachiEs.kind.get()
from('src/main/extras') {
exclude 'plugin-descriptor.properties'
}
into "build/package/${version}/${esKind.engine.kind}-${esKind.version}"
}

def packageJars = tasks.register('packageJars', Copy) {
from configurations.runtimeClasspath
from tasks.jar.outputs
Expand All @@ -83,7 +91,7 @@ def packageSpiJars = tasks.register('packageSpiJars', Copy) {

def distZip = tasks.register('distZip', Zip) {
var esKind = sudachiEs.kind.get()
dependsOn embedVersion, packageJars, packageSpiJars
dependsOn embedVersion, copyPluginMeta, packageJars, packageSpiJars
archiveBaseName.set("${esKind.engine.kind}-${esKind.version}-$archivesBaseName")
from("build/package/${version}/${esKind.engine.kind}-${esKind.version}", 'LICENSE', 'README.md')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class EsConventions implements Plugin<Project> {
@Override
void apply(Project target) {
target.tasks.withType(JavaCompile).configureEach {
options.release.set(11)
options.release.set(17)
options.encoding = 'UTF-8'
}

Expand Down
32 changes: 10 additions & 22 deletions buildSrc/src/main/groovy/com/worksap/nlp/tools/engines.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ trait EngineSupport {
}

enum EsSupport implements EngineSupport {
Es74("es-7.04"),
Es78("es-7.08"),
Es715("es-7.15"),
Es80("es-8.00"),
Es83("es-8.03"),
Es84("es-8.04"),
Es810("es-8.10"),
Es812("es-8.12"),
Es816("es-8.16"),
Es818("es-8.18"),

String tag
List<String> keys
Expand All @@ -23,24 +19,16 @@ enum EsSupport implements EngineSupport {
}

static EsSupport supportVersion(Version vers) {
if (vers.lt(7, 4)) {
throw new IllegalArgumentException("versions below 7.4 are not supported")
} else if (vers.ge(7, 4) && vers.lt(7, 8)) {
return Es74
} else if (vers.ge(7, 8) && vers.lt(7, 15)) {
return Es78
} else if (vers.ge(7, 15) && vers.lt(8, 0)) {
return Es715
} else if (vers.ge(8, 0) && vers.lt(8, 3)) {
return Es80
} else if (vers.ge(8, 3) && vers.lt(8, 4)) {
return Es83
} else if (vers.ge(8, 4) && vers.lt(8, 10)) {
return Es84
if (vers.lt(8, 10)) {
throw new IllegalArgumentException("versions below 8.10 are not supported")
} else if (vers.ge(8, 10) && vers.lt(8, 12)) {
return Es810
} else if (vers.ge(8, 12) && vers.lt(9, 0)) {
} else if (vers.ge(8, 12) && vers.lt(8, 16)) {
return Es812
} else if (vers.ge(8, 16) && vers.lt(8, 18)) {
return Es816
} else if (vers.ge(8, 18) && vers.lt(9, 0)) {
return Es818
} else {
throw new IllegalArgumentException("unsupported ElasticSearch version: " + vers.raw)
}
Expand Down Expand Up @@ -169,4 +157,4 @@ class ProjectKind {
Version parsedVersion() {
return Version.fromRaw(version)
}
}
}
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# elasticsearch versions: 8.15.2, 8.14.3, 8.13.4, 8.12.2, 8.11.4, 8.10.4, 8.9.2,
# 8.8.1, 8.6.2, 8.5.3, 8.4.3, 8.2.3, 7.17.24, 7.14.2, 7.10.2
# elasticsearch versions: 8.18.3, 8.17.8, 8.16.6, 8.15.2, 8.14.3, 8.13.4, 8.12.2,
# 8.11.4, 8.10.4
# opensearch version: 2.18.0, 2.17.1, 2.16.0, 2.15.0, 2.14.0, 2.13.0, 2.12.0, 2.11.1,
# 2.10.0, 2.9.0, 2.8.0, 2.7.0, 2.6.0
engineVersion=es:8.15.2
engineVersion=es:8.19.2
org.gradle.jvmargs=-XX:MaxMetaspaceSize=350m \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
Expand Down
6 changes: 4 additions & 2 deletions integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ plugins {
version = properties["pluginVersion"]

compileKotlin {
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}

compileTestKotlin {
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}

configurations { buildSudachiDict }
Expand Down Expand Up @@ -94,10 +94,12 @@ test {

def distZip = tasks.register('distZip', Zip) {
var esKind = sudachiEs.kind.get()
dependsOn(project(':subplugin').copyPluginMeta)
archiveBaseName.set("${esKind.engine.kind}-${esKind.version}-$archivesBaseName")
from(
project(':subplugin').packageJars.outputs.files,
project(':subplugin').embedVersion.outputs.files,
project(':subplugin').copyPluginMeta.outputs.files,
project(':testlib').jar.outputs.files,
)
}
Expand Down

This file was deleted.

34 changes: 0 additions & 34 deletions integration/src/test/ext/es-8.03/SudachiInSearchEngineEnv.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024 Works Applications Co., Ltd.
* Copyright (c) 2023-2025 Works Applications Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Works Applications Co., Ltd.
* Copyright (c) 2024-2025 Works Applications Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Works Applications Co., Ltd.
* Copyright (c) 2024-2025 Works Applications Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,7 @@ fun SudachiInSearchEngineEnv.makePluginService(): PluginsServiceAlias {

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java)
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java).toList()
val env = environment()
return AnalysisModule(env, analysisPlugins, plugins.stablePluginRegistry)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Works Applications Co., Ltd.
* Copyright (c) 2024-2025 Works Applications Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,17 +18,22 @@ package com.worksap.nlp.elasticsearch.sudachi

import org.elasticsearch.indices.analysis.AnalysisModule
import org.elasticsearch.plugins.AnalysisPlugin
import org.elasticsearch.plugins.PluginsLoader
import org.elasticsearch.plugins.PluginsService

typealias PluginsServiceAlias = PluginsService

fun SudachiInSearchEngineEnv.makePluginService(): PluginsServiceAlias {
return PluginsService(settings(), configPath, null, pluginsPath)
return PluginsService(
settings(),
configPath,
PluginsLoader.createPluginsLoader(
null, PluginsLoader.loadPluginsBundles(pluginsPath), null, false))
}

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java)
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java).toList()
val env = environment()
return AnalysisModule(env, analysisPlugins, plugins.stablePluginRegistry)
}
Loading
Loading