Skip to content

Commit 168a798

Browse files
committed
support es 5.0.0-alpha5
1 parent efb393f commit 168a798

File tree

9 files changed

+723
-189
lines changed

9 files changed

+723
-189
lines changed

licenses/lucene-LICENSE.txt

Lines changed: 475 additions & 0 deletions
Large diffs are not rendered by default.

licenses/lucene-NOTICE.txt

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
Apache Lucene
2+
Copyright 2014 The Apache Software Foundation
3+
4+
This product includes software developed at
5+
The Apache Software Foundation (http://www.apache.org/).
6+
7+
Includes software from other Apache Software Foundation projects,
8+
including, but not limited to:
9+
- Apache Ant
10+
- Apache Jakarta Regexp
11+
- Apache Commons
12+
- Apache Xerces
13+
14+
ICU4J, (under analysis/icu) is licensed under an MIT styles license
15+
and Copyright (c) 1995-2008 International Business Machines Corporation and others
16+
17+
Some data files (under analysis/icu/src/data) are derived from Unicode data such
18+
as the Unicode Character Database. See http://unicode.org/copyright.html for more
19+
details.
20+
21+
Brics Automaton (under core/src/java/org/apache/lucene/util/automaton) is
22+
BSD-licensed, created by Anders Møller. See http://www.brics.dk/automaton/
23+
24+
The levenshtein automata tables (under core/src/java/org/apache/lucene/util/automaton) were
25+
automatically generated with the moman/finenight FSA library, created by
26+
Jean-Philippe Barrette-LaPierre. This library is available under an MIT license,
27+
see http://sites.google.com/site/rrettesite/moman and
28+
http://bitbucket.org/jpbarrette/moman/overview/
29+
30+
The class org.apache.lucene.util.WeakIdentityMap was derived from
31+
the Apache CXF project and is Apache License 2.0.
32+
33+
The Google Code Prettify is Apache License 2.0.
34+
See http://code.google.com/p/google-code-prettify/
35+
36+
JUnit (junit-4.10) is licensed under the Common Public License v. 1.0
37+
See http://junit.sourceforge.net/cpl-v10.html
38+
39+
This product includes code (JaspellTernarySearchTrie) from Java Spelling Checkin
40+
g Package (jaspell): http://jaspell.sourceforge.net/
41+
License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
42+
43+
The snowball stemmers in
44+
analysis/common/src/java/net/sf/snowball
45+
were developed by Martin Porter and Richard Boulton.
46+
The snowball stopword lists in
47+
analysis/common/src/resources/org/apache/lucene/analysis/snowball
48+
were developed by Martin Porter and Richard Boulton.
49+
The full snowball package is available from
50+
http://snowball.tartarus.org/
51+
52+
The KStem stemmer in
53+
analysis/common/src/org/apache/lucene/analysis/en
54+
was developed by Bob Krovetz and Sergio Guzman-Lara (CIIR-UMass Amherst)
55+
under the BSD-license.
56+
57+
The Arabic,Persian,Romanian,Bulgarian, and Hindi analyzers (common) come with a default
58+
stopword list that is BSD-licensed created by Jacques Savoy. These files reside in:
59+
analysis/common/src/resources/org/apache/lucene/analysis/ar/stopwords.txt,
60+
analysis/common/src/resources/org/apache/lucene/analysis/fa/stopwords.txt,
61+
analysis/common/src/resources/org/apache/lucene/analysis/ro/stopwords.txt,
62+
analysis/common/src/resources/org/apache/lucene/analysis/bg/stopwords.txt,
63+
analysis/common/src/resources/org/apache/lucene/analysis/hi/stopwords.txt
64+
See http://members.unine.ch/jacques.savoy/clef/index.html.
65+
66+
The German,Spanish,Finnish,French,Hungarian,Italian,Portuguese,Russian and Swedish light stemmers
67+
(common) are based on BSD-licensed reference implementations created by Jacques Savoy and
68+
Ljiljana Dolamic. These files reside in:
69+
analysis/common/src/java/org/apache/lucene/analysis/de/GermanLightStemmer.java
70+
analysis/common/src/java/org/apache/lucene/analysis/de/GermanMinimalStemmer.java
71+
analysis/common/src/java/org/apache/lucene/analysis/es/SpanishLightStemmer.java
72+
analysis/common/src/java/org/apache/lucene/analysis/fi/FinnishLightStemmer.java
73+
analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchLightStemmer.java
74+
analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchMinimalStemmer.java
75+
analysis/common/src/java/org/apache/lucene/analysis/hu/HungarianLightStemmer.java
76+
analysis/common/src/java/org/apache/lucene/analysis/it/ItalianLightStemmer.java
77+
analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseLightStemmer.java
78+
analysis/common/src/java/org/apache/lucene/analysis/ru/RussianLightStemmer.java
79+
analysis/common/src/java/org/apache/lucene/analysis/sv/SwedishLightStemmer.java
80+
81+
The Stempel analyzer (stempel) includes BSD-licensed software developed
82+
by the Egothor project http://egothor.sf.net/, created by Leo Galambos, Martin Kvapil,
83+
and Edmond Nolan.
84+
85+
The Polish analyzer (stempel) comes with a default
86+
stopword list that is BSD-licensed created by the Carrot2 project. The file resides
87+
in stempel/src/resources/org/apache/lucene/analysis/pl/stopwords.txt.
88+
See http://project.carrot2.org/license.html.
89+
90+
The SmartChineseAnalyzer source code (smartcn) was
91+
provided by Xiaoping Gao and copyright 2009 by www.imdict.net.
92+
93+
WordBreakTestUnicode_*.java (under modules/analysis/common/src/test/)
94+
is derived from Unicode data such as the Unicode Character Database.
95+
See http://unicode.org/copyright.html for more details.
96+
97+
The Morfologik analyzer (morfologik) includes BSD-licensed software
98+
developed by Dawid Weiss and Marcin Miłkowski (http://morfologik.blogspot.com/).
99+
100+
Morfologik uses data from Polish ispell/myspell dictionary
101+
(http://www.sjp.pl/slownik/en/) licenced on the terms of (inter alia)
102+
LGPL and Creative Commons ShareAlike.
103+
104+
Morfologic includes data from BSD-licensed dictionary of Polish (SGJP)
105+
(http://sgjp.pl/morfeusz/)
106+
107+
Servlet-api.jar and javax.servlet-*.jar are under the CDDL license, the original
108+
source code for this can be found at http://www.eclipse.org/jetty/downloads.php
109+
110+
===========================================================================
111+
Kuromoji Japanese Morphological Analyzer - Apache Lucene Integration
112+
===========================================================================
113+
114+
This software includes a binary and/or source version of data from
115+
116+
mecab-ipadic-2.7.0-20070801
117+
118+
which can be obtained from
119+
120+
http://atilika.com/releases/mecab-ipadic/mecab-ipadic-2.7.0-20070801.tar.gz
121+
122+
or
123+
124+
http://jaist.dl.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz
125+
126+
===========================================================================
127+
mecab-ipadic-2.7.0-20070801 Notice
128+
===========================================================================
129+
130+
Nara Institute of Science and Technology (NAIST),
131+
the copyright holders, disclaims all warranties with regard to this
132+
software, including all implied warranties of merchantability and
133+
fitness, in no event shall NAIST be liable for
134+
any special, indirect or consequential damages or any damages
135+
whatsoever resulting from loss of use, data or profits, whether in an
136+
action of contract, negligence or other tortuous action, arising out
137+
of or in connection with the use or performance of this software.
138+
139+
A large portion of the dictionary entries
140+
originate from ICOT Free Software. The following conditions for ICOT
141+
Free Software applies to the current dictionary as well.
142+
143+
Each User may also freely distribute the Program, whether in its
144+
original form or modified, to any third party or parties, PROVIDED
145+
that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
146+
on, or be attached to, the Program, which is distributed substantially
147+
in the same form as set out herein and that such intended
148+
distribution, if actually made, will neither violate or otherwise
149+
contravene any of the laws and regulations of the countries having
150+
jurisdiction over the User or the intended distribution itself.
151+
152+
NO WARRANTY
153+
154+
The program was produced on an experimental basis in the course of the
155+
research and development conducted during the project and is provided
156+
to users as so produced on an experimental basis. Accordingly, the
157+
program is provided without any warranty whatsoever, whether express,
158+
implied, statutory or otherwise. The term "warranty" used herein
159+
includes, but is not limited to, any warranty of the quality,
160+
performance, merchantability and fitness for a particular purpose of
161+
the program and the nonexistence of any infringement or violation of
162+
any right of any third party.
163+
164+
Each user of the program will agree and understand, and be deemed to
165+
have agreed and understood, that there is no warranty whatsoever for
166+
the program and, accordingly, the entire risk arising from or
167+
otherwise connected with the program is assumed by the user.
168+
169+
Therefore, neither ICOT, the copyright holder, or any other
170+
organization that participated in or was otherwise related to the
171+
development of the program and their respective officials, directors,
172+
officers and other employees shall be held liable for any and all
173+
damages, including, without limitation, general, special, incidental
174+
and consequential damages, arising out of or otherwise in connection
175+
with the use or inability to use the program or any product, material
176+
or result produced or otherwise obtained by using the program,
177+
regardless of whether they have been advised of, or otherwise had
178+
knowledge of, the possibility of such damages at any time during the
179+
project or thereafter. Each user will be deemed to have agreed to the
180+
foregoing by his or her commencement of use of the program. The term
181+
"use" as used herein includes, but is not limited to, the use,
182+
modification, copying and distribution of the program and the
183+
production of secondary products from the program.
184+
185+
In the case where the program, whether in its original form or
186+
modified, was distributed or delivered to or received by a user from
187+
any person, organization or entity other than ICOT, unless it makes or
188+
grants independently of ICOT any specific warranty to the user in
189+
writing, such person, organization or entity, will also be exempted
190+
from and not be held liable to the user for any such damages as noted
191+
above as far as the program is concerned.

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>org.elasticsearch</groupId>
88
<artifactId>elasticsearch-analysis-ik</artifactId>
9-
<version>1.9.5</version>
9+
<version>${elasticsearch.version}</version>
1010
<packaging>jar</packaging>
1111
<description>IK Analyzer for Elasticsearch</description>
1212
<inceptionYear>2011</inceptionYear>
1313

1414
<properties>
15-
<elasticsearch.version>2.3.5</elasticsearch.version>
16-
<maven.compiler.target>1.7</maven.compiler.target>
15+
<elasticsearch.version>5.0.0-alpha5</elasticsearch.version>
16+
<maven.compiler.target>1.8</maven.compiler.target>
1717
<elasticsearch.assembly.descriptor>${project.basedir}/src/main/assemblies/plugin.xml</elasticsearch.assembly.descriptor>
1818
<elasticsearch.plugin.name>analysis-ik</elasticsearch.plugin.name>
1919
<elasticsearch.plugin.classname>org.elasticsearch.plugin.analysis.ik.AnalysisIkPlugin</elasticsearch.plugin.classname>
@@ -113,8 +113,8 @@
113113
<artifactId>maven-compiler-plugin</artifactId>
114114
<version>3.5.1</version>
115115
<configuration>
116-
<source>1.7</source>
117-
<target>1.7</target>
116+
<source>1.8</source>
117+
<target>1.8</target>
118118
</configuration>
119119
</plugin>
120120
<plugin>

src/main/java/org/elasticsearch/index/analysis/IkAnalysisBinderProcessor.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/java/org/elasticsearch/index/analysis/IkAnalyzerProvider.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
package org.elasticsearch.index.analysis;
22

3-
import org.elasticsearch.common.inject.Inject;
4-
import org.elasticsearch.common.inject.assistedinject.Assisted;
53
import org.elasticsearch.common.settings.Settings;
64
import org.elasticsearch.env.Environment;
7-
import org.elasticsearch.index.Index;
8-
import org.elasticsearch.index.settings.IndexSettingsService;
5+
import org.elasticsearch.index.IndexSettings;
96
import org.wltea.analyzer.cfg.Configuration;
10-
import org.wltea.analyzer.dic.Dictionary;
117
import org.wltea.analyzer.lucene.IKAnalyzer;
128

139
public class IkAnalyzerProvider extends AbstractIndexAnalyzerProvider<IKAnalyzer> {
1410
private final IKAnalyzer analyzer;
1511

16-
@Inject
17-
public IkAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
18-
super(index, indexSettingsService.getSettings(), name, settings);
12+
public IkAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings,boolean useSmart) {
13+
super(indexSettings, name, settings);
1914

20-
Configuration configuration=new Configuration(env,settings);
15+
Configuration configuration=new Configuration(env,settings).setUseSmart(useSmart);
2116

2217
analyzer=new IKAnalyzer(configuration);
2318
}
2419

20+
public static IkAnalyzerProvider getIkSmartAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) {
21+
return new IkAnalyzerProvider(indexSettings,env,name,settings,true);
22+
}
23+
24+
public static IkAnalyzerProvider getIkAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) {
25+
return new IkAnalyzerProvider(indexSettings,env,name,settings,false);
26+
}
27+
2528
@Override public IKAnalyzer get() {
2629
return this.analyzer;
2730
}

src/main/java/org/elasticsearch/index/analysis/IkTokenizerFactory.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
package org.elasticsearch.index.analysis;
22

33
import org.apache.lucene.analysis.Tokenizer;
4-
import org.elasticsearch.common.inject.Inject;
5-
import org.elasticsearch.common.inject.assistedinject.Assisted;
64
import org.elasticsearch.common.settings.Settings;
75
import org.elasticsearch.env.Environment;
8-
import org.elasticsearch.index.Index;
9-
import org.elasticsearch.index.settings.IndexSettingsService;
6+
import org.elasticsearch.index.IndexSettings;
107
import org.wltea.analyzer.cfg.Configuration;
118
import org.wltea.analyzer.lucene.IKTokenizer;
129

1310
public class IkTokenizerFactory extends AbstractTokenizerFactory {
1411
private Configuration configuration;
1512

16-
@Inject
17-
public IkTokenizerFactory(Index index, IndexSettingsService indexSettingsService,Environment env, @Assisted String name, @Assisted Settings settings) {
18-
super(index, indexSettingsService.getSettings(), name, settings);
13+
public IkTokenizerFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
14+
super(indexSettings, name, settings);
1915
configuration=new Configuration(env,settings);
2016
}
2117

18+
public static IkTokenizerFactory getIkTokenizerFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
19+
return new IkTokenizerFactory(indexSettings,env, name, settings).setSmart(false);
20+
}
21+
22+
public static IkTokenizerFactory getIkSmartTokenizerFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
23+
return new IkTokenizerFactory(indexSettings,env, name, settings).setSmart(true);
24+
}
25+
26+
public IkTokenizerFactory setSmart(boolean smart){
27+
this.configuration.setUseSmart(smart);
28+
return this;
29+
}
30+
2231
@Override
2332
public Tokenizer create() {
2433
return new IKTokenizer(configuration); }

0 commit comments

Comments
 (0)