我需要一个可以执行以下操作的Lucene Tokenizer。鉴于字符串“葡萄酒瓶盖”,以下查询应该成功
这是我到目前为止所拥有的。我怎么能修改它才能工作?不应该少于三个字符的查询。
public class PorterAnalyzer extends Analyzer {
private final Version version;
public PorterAnalyzer(Version version) {
this.version = version;
}
@Override
@SuppressWarnings("resource")
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
final StandardTokenizer src = new StandardTokenizer(reader);
TokenStream tok = new StandardFilter(src);
tok = new LowerCaseFilter( tok);
tok = new StopFilter( tok, StandardAnalyzer.STOP_WORDS_SET);
tok = new PorterStemFilter(tok);
return new TokenStreamComponents(src, tok);
}
}