Skip to content

Commit

Permalink
update to es 2.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
medcl committed Sep 19, 2016
1 parent 3fd9428 commit c82e219
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 82 deletions.
76 changes: 2 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ you can download this plugin from RTF project(https://github.com/medcl/elasticse
--------------------------------------------------
| STConvert Analysis Plugin | Elasticsearch |
--------------------------------------------------
| 1.8.5 | 2.3.5 |
--------------------------------------------------
| 1.8.4 | 2.3.4 |
--------------------------------------------------
| 1.8.3 | 2.3.3 |
Expand Down Expand Up @@ -78,77 +80,3 @@ Analyze tests
{"tokens":[{"token":"北京國際電視檯","start_offset":0,"end_offset":7,"type":"word","position":0},{"token":"北京國際電視臺","start_offset":8,"end_offset":15,"type":"word","position":1}]}%
```

Custom analyzer example:

elasticsearch.yml

```
index:
analysis:
tokenizer:
s2t_convert:
type: stconvert
delimiter: ","
convert_type: s2t
t2s_convert:
type: stconvert
delimiter: ","
convert_type: t2s
s2t_keep_both_convert:
type: stconvert
delimiter: ","
keep_both: 'true'
convert_type: s2t
t2s_keep_both_convert:
type: stconvert
delimiter: ","
keep_both: 'true'
convert_type: t2s
filter:
s2t_convert:
type: stconvert
delimiter: ","
convert_type: s2t
t2s_convert:
type: stconvert
delimiter: ","
convert_type: t2s
s2t_keep_both_convert:
type: stconvert
delimiter: ","
keep_both: 'true'
convert_type: s2t
t2s_keep_both_convert:
type: stconvert
delimiter: ","
keep_both: 'true'
convert_type: t2s
analyzer:
stconvert:
alias:
- st_analyzer
type: stconvert
s2t_convert:
type: stconvert
delimiter: ","
convert_type: s2t
t2s_convert:
type: stconvert
delimiter: ","
convert_type: t2s
s2t_keep_both_convert:
type: stconvert
delimiter: ","
keep_both: 'true'
convert_type: s2t
t2s_keep_both_convert:
type: stconvert
delimiter: ","
keep_both: 'true'
convert_type: t2s
```
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.infinitbyte</groupId>
<artifactId>elasticsearch-analysis-stconvert</artifactId>
<version>1.8.4</version>
<version>1.8.5</version>
<packaging>jar</packaging>
<url>http://log.medcl.net</url>
<description>stconvert is a analysis plugin that convert Chinese characters between traditional and simplified.</description>
Expand All @@ -32,7 +32,7 @@
</parent>

<properties>
<elasticsearch.version>2.3.4</elasticsearch.version>
<elasticsearch.version>2.3.5</elasticsearch.version>
<maven.compiler.target>1.7</maven.compiler.target>
<elasticsearch.assembly.descriptor>${project.basedir}/src/main/assemblies/plugin.xml</elasticsearch.assembly.descriptor>
<elasticsearch.plugin.name>analysis-stconvert</elasticsearch.plugin.name>
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/elasticsearch/index/analysis/STConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class STConverter {

private Properties charMap = new Properties();
private Properties revCharMap = new Properties();
private Set conflictingSets = new HashSet();
private Set<String> conflictingSets = new HashSet<String>();
private static STConverter instance=new STConverter();

public STConverter(){
Expand Down Expand Up @@ -65,10 +65,10 @@ private void initializeHelper() {
String keySubstring = key.substring(0, i + 1);
if (stringPossibilities.containsKey(keySubstring)) {
Integer integer = (Integer)(stringPossibilities.get(keySubstring));
stringPossibilities.put(keySubstring, new Integer(Integer.valueOf(integer) + 1));
stringPossibilities.put(keySubstring, Integer.valueOf(integer) + 1);

} else {
stringPossibilities.put(keySubstring, new Integer(1));
stringPossibilities.put(keySubstring, 1);
}

}
Expand All @@ -78,15 +78,15 @@ private void initializeHelper() {
iter = stringPossibilities.keySet().iterator();
while (iter.hasNext()) {
String key = (String) iter.next();
int value = Integer.valueOf( (Integer)stringPossibilities.get(key) );
int value = (Integer)stringPossibilities.get(key);
if (value > 1) {
conflictingSets.add(key);
}
}
}

public String convert(STConvertType type,String in) {
Map map=charMap;
Map<Object, Object> map=charMap;
if(type== STConvertType.SIMPLE_2_TRADITIONAL){
map=revCharMap;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public String convert(String text, STConvertType converterType) {
return getInstance().convert(converterType,text);
}

private static void mapping(Map map, StringBuilder outString, StringBuilder stackString) {
private static void mapping(Map<Object, Object> map, StringBuilder outString, StringBuilder stackString) {
while (stackString.length() > 0){
if (map.containsKey(stackString.toString())) {
outString.append(map.get(stackString.toString()));
Expand Down

0 comments on commit c82e219

Please sign in to comment.