Skip to content
This repository was archived by the owner on Oct 29, 2023. It is now read-only.

Commit 116f8f5

Browse files
committed
Upgrade to Elasticsearch 6.5.0
1 parent 791bde3 commit 116f8f5

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Uses the [langdetect](https://github.com/YouCruit/language-detection/) plugin to
66

77
| ES | Command |
88
| ----- | ------- |
9+
| 6.5.0 | `bin/elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-langdetect/releases/download/6.5.0.1/ingest-langdetect-6.5.0.1.zip` |
910
| 6.4.3 | `bin/elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-langdetect/releases/download/6.4.3.1/ingest-langdetect-6.4.3.1.zip` |
1011
| 6.4.2 | `bin/elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-langdetect/releases/download/6.4.2.1/ingest-langdetect-6.4.2.1.zip` |
1112
| 6.4.1 | `bin/elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-langdetect/releases/download/6.4.1.1/ingest-langdetect-6.4.1.1.zip` |

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath "org.elasticsearch.gradle:build-tools:6.4.3"
11+
classpath "org.elasticsearch.gradle:build-tools:6.5.0"
1212
}
1313
}
1414

@@ -18,7 +18,7 @@ plugins {
1818
}
1919

2020
group = 'de.spinscale.elasticsearch.plugin'
21-
version = '6.4.3.1-SNAPSHOT'
21+
version = '6.5.0.1-SNAPSHOT'
2222

2323
apply plugin: 'java'
2424
apply plugin: 'idea'

gradle/wrapper/gradle-wrapper.jar

1.72 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/org/elasticsearch/plugin/ingest/langdetect/LangDetectProcessor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import java.io.IOException;
2929
import java.util.Map;
3030

31+
import static org.elasticsearch.ingest.ConfigurationUtils.readBooleanProperty;
3132
import static org.elasticsearch.ingest.ConfigurationUtils.readOptionalStringProperty;
3233
import static org.elasticsearch.ingest.ConfigurationUtils.readStringProperty;
33-
import static org.elasticsearch.ingest.ConfigurationUtils.readBooleanProperty;
3434

3535
public class LangDetectProcessor extends AbstractProcessor {
3636

@@ -51,7 +51,7 @@ public LangDetectProcessor(String tag, String field, String targetField, ByteSiz
5151
}
5252

5353
@Override
54-
public void execute(IngestDocument ingestDocument) throws Exception {
54+
public IngestDocument execute(IngestDocument ingestDocument) throws Exception {
5555
Detector detector = DetectorFactory.create();
5656
detector.setMaxTextLength(maxLength.bytesAsInt());
5757

@@ -60,14 +60,16 @@ public void execute(IngestDocument ingestDocument) throws Exception {
6060
content = ingestDocument.getFieldValue(field, String.class);
6161
} catch (IllegalArgumentException e) {
6262
if (ignoreMissing) {
63-
return;
63+
return ingestDocument;
6464
}
6565
throw e;
6666
}
6767
detector.append(content);
6868
String language = detector.detect();
6969

7070
ingestDocument.setFieldValue(targetField, language);
71+
72+
return ingestDocument;
7173
}
7274

7375
@Override

src/test/java/org/elasticsearch/plugin/ingest/langdetect/LangDetectProcessorTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import com.cybozu.labs.langdetect.SecureDetectorFactory;
2121
import org.elasticsearch.common.settings.Settings;
2222
import org.elasticsearch.env.Environment;
23-
import org.elasticsearch.ingest.RandomDocumentPicks;
2423
import org.elasticsearch.ingest.IngestDocument;
24+
import org.elasticsearch.ingest.RandomDocumentPicks;
2525
import org.elasticsearch.test.ESTestCase;
2626
import org.junit.BeforeClass;
2727

@@ -92,7 +92,6 @@ private Map<String, Object> ingestDocument(Map<String, Object> config, String fi
9292
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
9393

9494
LangDetectProcessor processor = new LangDetectProcessor.Factory().create(Collections.emptyMap(), randomAlphaOfLength(10), config);
95-
processor.execute(ingestDocument);
96-
return ingestDocument.getSourceAndMetadata();
95+
return processor.execute(ingestDocument).getSourceAndMetadata();
9796
}
9897
}

0 commit comments

Comments
 (0)