diff --git a/pom.xml b/pom.xml
index ea3fa1c..516dcd7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
org.xbib.elasticsearch
elasticsearch-langdetect
- 1.2.0
+ 1.0.0.RC1.1
jar
2012
@@ -38,7 +38,7 @@
- 0.90.3
+ 1.0.0.RC1
diff --git a/src/main/java/org/xbib/elasticsearch/action/langdetect/TransportLangdetectAction.java b/src/main/java/org/xbib/elasticsearch/action/langdetect/TransportLangdetectAction.java
index 75f9536..5bdaf6a 100644
--- a/src/main/java/org/xbib/elasticsearch/action/langdetect/TransportLangdetectAction.java
+++ b/src/main/java/org/xbib/elasticsearch/action/langdetect/TransportLangdetectAction.java
@@ -3,7 +3,7 @@
import java.util.List;
-import org.elasticsearch.ElasticSearchException;
+import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.single.custom.TransportSingleCustomOperationAction;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.ClusterState;
@@ -66,12 +66,12 @@ protected ClusterBlockException checkRequestBlock(ClusterState state, Langdetect
}
@Override
- protected LangdetectResponse shardOperation(LangdetectRequest request, int shardId) throws ElasticSearchException {
+ protected LangdetectResponse shardOperation(LangdetectRequest request, int shardId) throws ElasticsearchException {
try {
List langs = detector.detectAll(request.getText().toUtf8());
return new LangdetectResponse(langs);
} catch (LanguageDetectionException e) {
- throw new ElasticSearchException(e.getMessage(), e);
+ throw new ElasticsearchException(e.getMessage(), e);
}
}
}
diff --git a/src/main/java/org/xbib/elasticsearch/common/langdetect/Detector.java b/src/main/java/org/xbib/elasticsearch/common/langdetect/Detector.java
index bd33b4c..a778318 100644
--- a/src/main/java/org/xbib/elasticsearch/common/langdetect/Detector.java
+++ b/src/main/java/org/xbib/elasticsearch/common/langdetect/Detector.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.ElasticSearchException;
+import org.elasticsearch.ElasticsearchException;
public class Detector extends AbstractLifecycleComponent {
@@ -63,21 +63,21 @@ public Detector(Settings settings) {
try {
loadDefaultProfiles();
} catch (IOException e) {
- throw new ElasticSearchException(e.getMessage());
+ throw new ElasticsearchException(e.getMessage());
}
reset();
}
@Override
- protected void doStart() throws ElasticSearchException {
+ protected void doStart() throws ElasticsearchException {
}
@Override
- protected void doStop() throws ElasticSearchException {
+ protected void doStop() throws ElasticsearchException {
}
@Override
- protected void doClose() throws ElasticSearchException {
+ protected void doClose() throws ElasticsearchException {
}
public void loadDefaultProfiles() throws IOException {
diff --git a/src/main/java/org/xbib/elasticsearch/index/mapper/langdetect/LangdetectMapper.java b/src/main/java/org/xbib/elasticsearch/index/mapper/langdetect/LangdetectMapper.java
index f8388a5..13eb2bb 100644
--- a/src/main/java/org/xbib/elasticsearch/index/mapper/langdetect/LangdetectMapper.java
+++ b/src/main/java/org/xbib/elasticsearch/index/mapper/langdetect/LangdetectMapper.java
@@ -5,6 +5,8 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Hashtable;
+
+import org.apache.lucene.util.ToStringUtils;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.analysis.AnalysisService;
@@ -243,6 +245,10 @@ public void parse(ParseContext context) throws IOException {
context.externalValue(content);
contentMapper.parse(context);
+ if (content == null) {
+ return;
+ }
+
List langs = null;
try {
langs = detector.detectAll(content);
diff --git a/src/test/java/org/xbib/elasticsearch/module/langdetect/LangdetectMappingTest.java b/src/test/java/org/xbib/elasticsearch/module/langdetect/LangdetectMappingTest.java
index ec914f5..258b3b8 100644
--- a/src/test/java/org/xbib/elasticsearch/module/langdetect/LangdetectMappingTest.java
+++ b/src/test/java/org/xbib/elasticsearch/module/langdetect/LangdetectMappingTest.java
@@ -1,10 +1,9 @@
package org.xbib.elasticsearch.module.langdetect;
-import org.apache.lucene.index.IndexableField;
+import org.elasticsearch.index.mapper.ParseContext.Document;
import org.apache.lucene.analysis.core.KeywordAnalyzer;
import org.apache.lucene.analysis.en.EnglishAnalyzer;
import org.apache.lucene.analysis.fr.FrenchAnalyzer;
-import org.apache.lucene.document.Document;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.collect.Maps;
import org.elasticsearch.common.settings.ImmutableSettings;
@@ -50,7 +49,7 @@ public void setupMapperParser() throws IOException {
new PreBuiltAnalyzerProviderFactory("french", AnalyzerScope.INDEX, new FrenchAnalyzer(Version.LUCENE_CURRENT)));
AnalysisService analysisService = new AnalysisService(index,
ImmutableSettings.Builder.EMPTY_SETTINGS, null, analyzerFactoryFactories, null, null, null);
- mapperParser = new DocumentMapperParser(index, analysisService, new PostingsFormatService(index),
+ mapperParser = new DocumentMapperParser(index, analysisService, new PostingsFormatService(index), null,
new SimilarityLookupService(index, ImmutableSettings.Builder.EMPTY_SETTINGS));
Settings settings = settingsBuilder()
.build();