Skip to content

Commit cccc304

Browse files
committed
es 8.10.0 support
1 parent 74a2ba9 commit cccc304

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.ansj</groupId>
66
<artifactId>elasticsearch-analysis-ansj</artifactId>
7-
<version>8.9.2.0</version>
7+
<version>8.10.0.0</version>
88
<description>elasticsearch analysis by ansj</description>
99
<name>elasticsearch-analysis-ansj</name>
1010
<url>http://maven.nlpcn.org</url>
@@ -14,7 +14,7 @@
1414
<runSuite>**/MainTestSuite.class</runSuite>
1515
<elasticsearch.plugin.name>elasticsearch-analysis-ansj</elasticsearch.plugin.name>
1616
<elasticsearch.plugin.java.version>17</elasticsearch.plugin.java.version>
17-
<elasticsearch.version>8.9.2</elasticsearch.version>
17+
<elasticsearch.version>8.10.0</elasticsearch.version>
1818
<elasticsearch.plugin.classname>org.ansj.elasticsearch.plugin.AnalysisAnsjPlugin</elasticsearch.plugin.classname>
1919
</properties>
2020

src/main/java/org/ansj/elasticsearch/action/TransportAnsjAction.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import java.util.List;
5050
import java.util.Map;
5151
import java.util.concurrent.CountDownLatch;
52+
import java.util.concurrent.Executor;
5253
import java.util.concurrent.TimeUnit;
5354

5455
/**
@@ -271,8 +272,8 @@ public void handleException(TransportException exp) {
271272
}
272273

273274
@Override
274-
public String executor() {
275-
return ThreadPool.Names.SAME;
275+
public Executor executor(ThreadPool threadPool) {
276+
return TransportResponseHandler.TRANSPORT_WORKER;
276277
}
277278
};
278279

@@ -340,8 +341,8 @@ public void handleException(TransportException exp) {
340341
}
341342

342343
@Override
343-
public String executor() {
344-
return ThreadPool.Names.SAME;
344+
public Executor executor(ThreadPool threadPool) {
345+
return TransportResponseHandler.TRANSPORT_WORKER;
345346
}
346347
});
347348
}

src/main/java/org/ansj/elasticsearch/index/config/AnsjElasticConfigurator.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.apache.logging.log4j.LogManager;
1313
import org.apache.logging.log4j.Logger;
1414
import org.elasticsearch.SpecialPermission;
15-
import org.elasticsearch.common.collect.MapBuilder;
15+
import org.elasticsearch.common.collect.ImmutableOpenMap;
1616
import org.elasticsearch.common.settings.Settings;
1717
import org.elasticsearch.env.Environment;
1818
import org.nlpcn.commons.lang.tire.domain.SmartForest;
@@ -280,22 +280,22 @@ public void reloadLibrary(String key) {
280280
* 默认配置
281281
*/
282282
public static Map<String, String> getDefaults() {
283-
return MapBuilder.<String, String>newMapBuilder()
283+
return ImmutableOpenMap.<String, String>builder(10)
284284
// 是否开启人名识别
285-
.put("isNameRecognition", MyStaticValue.isNameRecognition.toString())
285+
.fPut("isNameRecognition", MyStaticValue.isNameRecognition.toString())
286286
// 是否开启数字识别
287-
.put("isNumRecognition", MyStaticValue.isNumRecognition.toString())
287+
.fPut("isNumRecognition", MyStaticValue.isNumRecognition.toString())
288288
// 是否数字和量词合并
289-
.put("isQuantifierRecognition", MyStaticValue.isQuantifierRecognition.toString())
289+
.fPut("isQuantifierRecognition", MyStaticValue.isQuantifierRecognition.toString())
290290
// 是否显示真实词语
291-
.put("isRealName", MyStaticValue.isRealName.toString())
291+
.fPut("isRealName", MyStaticValue.isRealName.toString())
292292
// 是否用户词典不加载相同的词
293-
.put("isSkipUserDefine", String.valueOf(MyStaticValue.isSkipUserDefine))
294-
.put(CrfLibrary.DEFAULT, CrfLibrary.DEFAULT)
295-
.put(DicLibrary.DEFAULT, DicLibrary.DEFAULT)
296-
.put(StopLibrary.DEFAULT, StopLibrary.DEFAULT)
297-
.put(SynonymsLibrary.DEFAULT, SynonymsLibrary.DEFAULT)
298-
.put(AmbiguityLibrary.DEFAULT, AmbiguityLibrary.DEFAULT)
299-
.immutableMap();
293+
.fPut("isSkipUserDefine", String.valueOf(MyStaticValue.isSkipUserDefine))
294+
.fPut(CrfLibrary.DEFAULT, CrfLibrary.DEFAULT)
295+
.fPut(DicLibrary.DEFAULT, DicLibrary.DEFAULT)
296+
.fPut(StopLibrary.DEFAULT, StopLibrary.DEFAULT)
297+
.fPut(SynonymsLibrary.DEFAULT, SynonymsLibrary.DEFAULT)
298+
.fPut(AmbiguityLibrary.DEFAULT, AmbiguityLibrary.DEFAULT)
299+
.build();
300300
}
301301
}

src/main/java/org/ansj/elasticsearch/plugin/AnalysisAnsjPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.elasticsearch.env.NodeEnvironment;
2929
import org.elasticsearch.index.analysis.AnalyzerProvider;
3030
import org.elasticsearch.index.analysis.TokenizerFactory;
31+
import org.elasticsearch.indices.IndicesService;
3132
import org.elasticsearch.indices.analysis.AnalysisModule;
3233
import org.elasticsearch.plugins.ActionPlugin;
3334
import org.elasticsearch.plugins.AnalysisPlugin;
@@ -54,7 +55,7 @@ public class AnalysisAnsjPlugin extends Plugin implements AnalysisPlugin, Action
5455
private static final Logger LOG = LogManager.getLogger();
5556

5657
@Override
57-
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, ScriptService scriptService, NamedXContentRegistry xContentRegistry, Environment environment, NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<RepositoriesService> repositoriesServiceSupplier, Tracer tracer, AllocationService allocationService) {
58+
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, ScriptService scriptService, NamedXContentRegistry xContentRegistry, Environment environment, NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<RepositoriesService> repositoriesServiceSupplier, Tracer tracer, AllocationService allocationService, IndicesService indicesService) {
5859
return Collections.singletonList(new AnsjElasticConfigurator(environment));
5960
}
6061

0 commit comments

Comments
 (0)