如何使用StandardTokenizer
应用LowerCaseFilter
,EdgeNgramFilter
和lucene 5.2.0
索引文档?
答案 0 :(得分:1)
试试这个
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="15" side="front" />
</analyzer>
</fieldType>
使用java
public TokenStream tokenStream(String fieldName,
Reader reader) {
TokenStream result = new StandardTokenizer(reader);
result = new StandardFilter(result);
result = new LowerCaseFilter(result);
result = new EdgeNGramTokenFilter(result, Side.FRONT,1,20);
return result;
}
检查此link