Skip to content

Commit

Permalink
Merge pull request #118 from mh-northlander/feature/update-versions-8.13
Browse files Browse the repository at this point in the history
build with es:8.13
  • Loading branch information
kazuma-t authored May 16, 2024
2 parents 60a790e + 2c02bb8 commit f838e2e
Show file tree
Hide file tree
Showing 21 changed files with 569 additions and 48 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ jobs:
strategy:
matrix:
es-version:
- 'es:8.8.1'
- '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.2.3'
- 'es:7.17.10'
- 'es:7.17.21'
- 'es:7.14.2'
- 'es:7.10.2'
- 'os:2.14.0'
- 'os:2.13.0'
- 'os:2.12.0'
- 'os:2.11.1'
- 'os:2.10.0'
- 'os:2.9.0'
Expand Down Expand Up @@ -89,6 +97,7 @@ jobs:
run: |
bash test-scripts/00-install-elasticsearch.sh
sleep 30
python3 test-scripts/01-integration-test.py
bash test-scripts/10-make-index.sh
python3 test-scripts/20-put-docs.py
python3 test-scripts/30-test-docs.py
Expand Down
12 changes: 9 additions & 3 deletions buildSrc/src/main/groovy/com/worksap/nlp/tools/engines.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ enum EsSupport implements EngineSupport {
Es78("es-7.08"),
Es715("es-7.15"),
Es80("es-8.00"),
Es83("es-8.30"),
Es84("es-8.40")
Es83("es-8.03"),
Es84("es-8.04"),
Es810("es-8.10"),
Es812("es-8.12"),

String tag
List<String> keys
Expand All @@ -33,8 +35,12 @@ enum EsSupport implements EngineSupport {
return Es80
} else if (vers.ge(8, 3) && vers.lt(8, 4)) {
return Es83
} else if (vers.ge(8, 4) && vers.lt(9, 0)) {
} else if (vers.ge(8, 4) && vers.lt(8, 10)) {
return Es84
} else if (vers.ge(8, 10) && vers.lt(8, 12)) {
return Es810
} else if (vers.ge(8, 12) && vers.lt(9, 0)) {
return Es812
} else {
throw new IllegalArgumentException("unsupported ElasticSearch version: " + vers.raw)
}
Expand Down
15 changes: 15 additions & 0 deletions integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ esTestEnv {
}

test {
onlyIf { ! (sudachiEs.isEs() && sudachiEs.kind.get().parsedVersion().ge(8, 9)) }
dependsOn(
':packageJars',
':packageSpiJars',
Expand All @@ -88,6 +89,20 @@ test {
defaultCharacterEncoding = 'utf-8'
}

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

artifacts {
archives distZip
}

spotless {
// watch for https://github.com/diffplug/spotless/issues/911 to be closed
ratchetFrom 'origin/develop'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Works Applications Co., Ltd.
* Copyright (c) 2023-2024 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 @@ -16,37 +16,18 @@

package com.worksap.nlp.elasticsearch.sudachi

import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction
import org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction
import org.elasticsearch.common.settings.Settings
import org.elasticsearch.env.Environment
import org.elasticsearch.indices.analysis.AnalysisModule
import org.elasticsearch.plugins.AnalysisPlugin
import org.elasticsearch.plugins.PluginsService

typealias SearchEngineTestCase = org.elasticsearch.test.ESTestCase

typealias PluginsServiceAlias = PluginsService

typealias AnalysisRegistryAlias = org.elasticsearch.index.analysis.AnalysisRegistry

typealias EnvironmentAlias = Environment

typealias SettingsAlias = Settings

typealias AnalysisPluginAlias = AnalysisPlugin
typealias EnvironmentAlias = org.elasticsearch.env.Environment

typealias AnalyzeActionRequestAlias = AnalyzeAction.Request
typealias SettingsAlias = org.elasticsearch.common.settings.Settings

typealias TransportAnalyzeActionAlias = TransportAnalyzeAction
typealias AnalysisPluginAlias = org.elasticsearch.plugins.AnalysisPlugin

fun SudachiInSearchEngineEnv.makePluginService(): PluginsServiceAlias {
return PluginsService(settings(), configPath, null, pluginsPath)
}
typealias AnalyzeActionRequestAlias =
org.elasticsearch.action.admin.indices.analyze.AnalyzeAction.Request

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java)
val env = environment()
return AnalysisModule(env, analysisPlugins, plugins.stablePluginRegistry)
}
typealias TransportAnalyzeActionAlias =
org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction
34 changes: 34 additions & 0 deletions integration/src/test/ext/es-8.00/SudachiInSearchEngineEnv.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.worksap.nlp.elasticsearch.sudachi

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

typealias PluginsServiceAlias = PluginsService

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

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java)
val env = environment()
return AnalysisModule(env, analysisPlugins, plugins.stablePluginRegistry)
}
34 changes: 34 additions & 0 deletions integration/src/test/ext/es-8.03/SudachiInSearchEngineEnv.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.worksap.nlp.elasticsearch.sudachi

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

typealias PluginsServiceAlias = PluginsService

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

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java)
val env = environment()
return AnalysisModule(env, analysisPlugins, plugins.stablePluginRegistry)
}
34 changes: 34 additions & 0 deletions integration/src/test/ext/es-8.04/SudachiInSearchEngineEnv.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.worksap.nlp.elasticsearch.sudachi

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

typealias PluginsServiceAlias = PluginsService

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

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java)
val env = environment()
return AnalysisModule(env, analysisPlugins, plugins.stablePluginRegistry)
}
34 changes: 34 additions & 0 deletions integration/src/test/ext/es-8.10/SudachiInSearchEngineEnv.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.worksap.nlp.elasticsearch.sudachi

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

typealias PluginsServiceAlias = PluginsService

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

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPlugin::class.java)
val env = environment()
return AnalysisModule(env, analysisPlugins, plugins.stablePluginRegistry)
}
34 changes: 34 additions & 0 deletions integration/src/test/ext/es-8.12-ge/SudachiInSearchEngineEnv.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.worksap.nlp.elasticsearch.sudachi

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

typealias PluginsServiceAlias = PluginsService

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

fun SudachiInSearchEngineEnv.makeAnalysisModule(): AnalysisModule {
val plugins = makePluginService()
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) 2023 Works Applications Co., Ltd.
* Copyright (c) 2023-2024 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 @@ -23,7 +23,7 @@ class BasicTest : SudachiEnvTest() {
@Test
fun canLoadPlugin() {
val plugins = sudachiEnv.makePluginService()
val analysisPlugins = plugins.filterPlugins(AnalysisPluginAlias::class.java)
val analysisPlugins = plugins.filterPlugins(AnalysisPluginAlias::class.java).toList()
Assert.assertEquals(2, analysisPlugins.size)
val plugin =
analysisPlugins.find {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023 Works Applications Co., Ltd.
* Copyright (c) 2022-2024 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) 2022-2023 Works Applications Co., Ltd.
* Copyright (c) 2022-2024 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) 2022-2023 Works Applications Co., Ltd.
* Copyright (c) 2022-2024 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
21 changes: 21 additions & 0 deletions src/test/ext/es-8.10-ge/IndexCreationContext.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2023-2024 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress("PackageDirectoryMismatch")

package com.worksap.nlp.search.aliases

typealias IndexCreationContext = org.elasticsearch.index.IndexService.IndexCreationContext
Loading

0 comments on commit f838e2e

Please sign in to comment.