Skip to content
This repository was archived by the owner on May 24, 2024. It is now read-only.

Commit 7dc29b1

Browse files
committed
ES 7.9.2
1 parent 476d2b3 commit 7dc29b1

File tree

3 files changed

+39
-25
lines changed

3 files changed

+39
-25
lines changed

build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
// This plugin's version (typically must match that of ES).
3-
version = '7.8.1'
3+
version = '7.9.2'
44
group = 'org.carrot2'
55

66
buildscript {
77
ext {
8-
version_es = '7.8.1'
8+
version_es = '7.9.2'
99
version_c2 = 'org.carrot2:carrot2-core:4.0.4'
1010
}
1111

@@ -19,9 +19,11 @@ buildscript {
1919
}
2020
}
2121

22-
apply plugin: 'java-library'
23-
apply plugin: 'idea'
24-
apply plugin: 'elasticsearch.esplugin'
22+
plugins {
23+
id 'java-library'
24+
id 'idea'
25+
id 'elasticsearch.esplugin'
26+
}
2527

2628
repositories {
2729
mavenLocal()

src/main/java/org/carrot2/elasticsearch/ClusteringAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ protected SearchResponse filterMaxHits(SearchResponse response, int maxHits) {
992992

993993
InternalAggregations _internalAggregations = null;
994994
if (response.getAggregations() != null) {
995-
_internalAggregations = new InternalAggregations(toInternal(response.getAggregations().asList()));
995+
_internalAggregations = new InternalAggregations(toInternal(response.getAggregations().asList()), null);
996996
}
997997

998998
SearchHits _searchHits =

src/main/java/org/carrot2/elasticsearch/ClusteringPlugin.java

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public ClusteringPlugin(Settings settings) {
6666
this.pluginEnabled = settings.getAsBoolean(DEFAULT_ENABLED_PROPERTY_NAME, true);
6767
this.transportClient = TransportClient.CLIENT_TYPE.equals(Client.CLIENT_TYPE_SETTING_S.get(settings));
6868

69-
// Invoke loadSPI on our own class loader to load default algorithms.
70-
reloadSPI(getClass().getClassLoader());
69+
// load our own class loader's extensions.
70+
loadExtensions(getClass().getClassLoader());
7171
}
7272

7373
@Override
@@ -136,22 +136,34 @@ private LinkedHashMap<String, ClusteringAlgorithmProvider> reorderAlgorithms(
136136
}
137137

138138
@Override
139-
public void reloadSPI(ClassLoader classLoader) {
140-
ServiceLoader.load(ClusteringAlgorithmProvider.class, classLoader).forEach((provider) -> {
141-
String name = provider.name();
142-
if (algorithmProviders.containsKey(name)) {
143-
throw new RuntimeException("More than one provider for algorithm " + name + "?");
144-
}
145-
algorithmProviders.put(name, provider);
146-
});
147-
148-
for (LanguageComponentsProvider provider :
149-
ServiceLoader.load(LanguageComponentsProvider.class, classLoader)) {
150-
for (String lang : provider.languages()) {
151-
languageComponentProviders
152-
.computeIfAbsent(lang, (k) -> new ArrayList<>())
153-
.add(provider);
154-
}
155-
}
139+
public void loadExtensions(ExtensionLoader loader) {
140+
loadExtensions(
141+
loader.loadExtensions(ClusteringAlgorithmProvider.class),
142+
loader.loadExtensions(LanguageComponentsProvider.class));
156143
}
144+
145+
private void loadExtensions(ClassLoader classLoader) {
146+
loadExtensions(
147+
ServiceLoader.load(ClusteringAlgorithmProvider.class, classLoader),
148+
ServiceLoader.load(LanguageComponentsProvider.class, classLoader));
149+
}
150+
151+
private void loadExtensions(Iterable<ClusteringAlgorithmProvider> clusteringAlgorithmProviders,
152+
Iterable<LanguageComponentsProvider> languageComponentsProviders) {
153+
clusteringAlgorithmProviders.forEach((provider) -> {
154+
String name = provider.name();
155+
if (algorithmProviders.containsKey(name)) {
156+
throw new RuntimeException("More than one provider for algorithm " + name + "?");
157+
}
158+
algorithmProviders.put(name, provider);
159+
});
160+
161+
languageComponentsProviders.forEach(provider -> {
162+
for (String lang : provider.languages()) {
163+
languageComponentProviders
164+
.computeIfAbsent(lang, (k) -> new ArrayList<>())
165+
.add(provider);
166+
}
167+
});
168+
}
157169
}

0 commit comments

Comments
 (0)