add default config
This commit is contained in:
parent
0eaba078f9
commit
ee419af6ea
@ -28,6 +28,7 @@ import java.io.Reader;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.Tokenizer;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.Environment;
|
||||
|
||||
@ -66,8 +67,8 @@ public final class IKAnalyzer extends Analyzer{
|
||||
this.useSmart = useSmart;
|
||||
}
|
||||
|
||||
Settings settings;
|
||||
Environment environment;
|
||||
Settings settings=ImmutableSettings.EMPTY;
|
||||
Environment environment=new Environment();
|
||||
|
||||
public IKAnalyzer(Settings indexSetting,Settings settings, Environment environment) {
|
||||
super();
|
||||
|
@ -49,7 +49,8 @@ public class IKAnalzyerDemo {
|
||||
//获取Lucene的TokenStream对象
|
||||
TokenStream ts = null;
|
||||
try {
|
||||
ts = analyzer.tokenStream("myfield", new StringReader("这是一个中文分词的例子,你可以直接运行它!IKAnalyer can analysis english text too"));
|
||||
ts = analyzer.tokenStream("myfield", new StringReader("WORLD ,.. html DATA</html>HELLO"));
|
||||
// ts = analyzer.tokenStream("myfield", new StringReader("这是一个中文分词的例子,你可以直接运行它!IKAnalyer can analysis english text too"));
|
||||
//获取词元位置属性
|
||||
OffsetAttribute offset = ts.addAttribute(OffsetAttribute.class);
|
||||
//获取词元文本属性
|
||||
|
Loading…
x
Reference in New Issue
Block a user