Skip to content

Commit

Permalink
1.0.0.RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
David JANSSEN committed Apr 9, 2014
1 parent f5e7b33 commit d6ee08e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>org.xbib.elasticsearch</groupId>
<artifactId>elasticsearch-langdetect</artifactId>
<version>1.2.0</version>
<version>1.0.0.RC1.1</version>
<packaging>jar</packaging>

<inceptionYear>2012</inceptionYear>
Expand Down Expand Up @@ -38,7 +38,7 @@
</distributionManagement>

<properties>
<elasticsearch.version>0.90.3</elasticsearch.version>
<elasticsearch.version>1.0.0.RC1</elasticsearch.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Language> 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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Detector> {

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -243,6 +245,10 @@ public void parse(ParseContext context) throws IOException {
context.externalValue(content);
contentMapper.parse(context);

if (content == null) {
return;
}

List<Language> langs = null;
try {
langs = detector.detectAll(content);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d6ee08e

Please sign in to comment.