From 1368fbe856c3c420370074665954e92e7b17c7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Thu, 20 Nov 2014 21:38:37 +0100 Subject: [PATCH] settings in the mapping --- README.md | 5 +++-- .../mapper/langdetect/LangdetectMapper.java | 9 ++++++++ .../module/langdetect/LangdetectService.java | 16 +++++++------- .../langdetect/LangdetectMappingTest.java | 21 +++++++++++++++++++ .../mapper/langdetect/short-text-mapping.json | 10 +++++++++ 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 src/test/resources/org/xbib/elasticsearch/index/mapper/langdetect/short-text-mapping.json diff --git a/README.md b/README.md index b01d65a..f4407f2 100644 --- a/README.md +++ b/README.md @@ -77,13 +77,13 @@ zh-cn zh-tw - ## Versions ![Travis](https://travis-ci.org/jprante/elasticsearch-langdetect.png) | Elasticsearch | Plugin | Release date | | -------------- | -------------- | ------------ | +| 1.4.0 | 1.4.0.1 | Nov 20, 2014 | | 1.4.0 | 1.4.0.0 | Nov 14, 2014 | | 1.3.1 | 1.3.0.0 | Jul 30, 2014 | | 1.2.1 | 1.2.1.1 | Jun 18, 2014 | @@ -91,7 +91,7 @@ zh-tw ## Installation - ./bin/plugin -install langdetect -url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-langdetect/1.4.0.0/elasticsearch-langdetect-1.4.0.0-plugin.zip + ./bin/plugin -install langdetect -url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-langdetect/1.4.0.1/elasticsearch-langdetect-1.4.0.1-plugin.zip Do not forget to restart the node after installing. @@ -99,6 +99,7 @@ Do not forget to restart the node after installing. | File | SHA1 | | --------------------------------------------- | -----------------------------------------| +| elasticsearch-langdetect-1.4.0.1-plugin.zip | a7ab2401ae68789bf1e5841427ce40440c903da4 | | elasticsearch-langdetect-1.4.0.0-plugin.zip | f95361fa1a81b2681e2e9002b03ca6aad57f3012 | | elasticsearch-langdetect-1.3.0.0-plugin.zip | e2dd56c72f19cec861141becd8beb18d7bb26ee6 | | elasticsearch-langdetect-1.2.1.1-plugin.zip | cc3a0d5ccecf1210b96771dcb5c9935176e1cc35 | 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 a792f9d..ea65b9d 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 @@ -55,6 +55,11 @@ public Builder lang(StringFieldMapper.Builder lang) { return this; } + public Builder profile(String profile) { + settingsBuilder.put("profile", profile); + return this; + } + public Builder ntrials(int trials) { settingsBuilder.put("number_of_trials", trials); return this; @@ -203,6 +208,10 @@ public Mapper.Builder parse(String name, Map node, ParserContext builder.languages((List) fieldNode); break; } + case "profile": { + builder.profile((String) fieldNode); + break; + } } } return builder; diff --git a/src/main/java/org/xbib/elasticsearch/module/langdetect/LangdetectService.java b/src/main/java/org/xbib/elasticsearch/module/langdetect/LangdetectService.java index 49aee02..18ff5ac 100644 --- a/src/main/java/org/xbib/elasticsearch/module/langdetect/LangdetectService.java +++ b/src/main/java/org/xbib/elasticsearch/module/langdetect/LangdetectService.java @@ -26,7 +26,7 @@ public class LangdetectService extends AbstractLifecycleComponent