提交 ee419af6 编写于 作者: weixin_43283383's avatar weixin_43283383

add default config

上级 0eaba078
......@@ -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);
//获取词元文本属性
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册