public class CatalogSearchAnalyzer extends Analyzer {
private Version matchVersion;
private String termValue;
private boolean retMultiple;
public static final String[] STOP_WORDS = { "a", "and", "are", "as", "at",
"be", "but", "by", "for", "if", "in", "into", "is", "it", "no",
"not", "of", "on", "or", "such", "t", "that", "the", "their",
"then", "there", "these", "they", "this", "to", "was", "will",
"with" };
private CharArraySet stopTable;
private int maxTokenLength;
public CatalogSearchAnalyzer(Version matchVersion) {
this.stopTable = StopFilter.makeStopSet(STOP_WORDS);
this.maxTokenLength = 255;
this.matchVersion = matchVersion;
}
public CatalogSearchAnalyzer() {
this(STOP_WORDS);
}
public void setTermValue(String termValue) {
}
public void setRetMultiple(boolean retMultiple) {
}
public CatalogSearchAnalyzer(String[] stopWords) {
this.stopTable = StopFilter.makeStopSet(STOP_WORDS);
this.maxTokenLength = 255;
StopFilter.makeStopSet(stopWords);
}
private TokenStream getStemmingFilter(TokenStream result) {
PorterStemFilter temp = new PorterStemFilter(result);
temp.setRetMultiple(this.retMultiple);
return temp;
}
protected Analyzer.TokenStreamComponents createComponents(String fieldName) {
StandardTokenizer st = new StandardTokenizer();
st.setMaxTokenLength(this.maxTokenLength);
Tokenizer tk = st;
TokenStream ts = new StandardFilter(tk);
ts = new LowerCaseFilter(ts);
ts = new StopFilter(ts, this.stopTable);
ts = getStemmingFilter(ts);
return new Analyzer.TokenStreamComponents(tk, ts) {
protected void setReader(Reader reader) {
int m = CatalogSearchAnalyzer.this.maxTokenLength;
if (this.source instanceof CmgtTokenizer) {
((CmgtTokenizer) this.source).setMaxTokenLength(m);
}
super.setReader(reader);
}
};
}
}
“我把我的罐子加到卢克身上,没有任何例外。
提前感谢你对此的调查。
正如问题下的评论部分所述,解决方案是使用原始的基于thinlet的luke版本,而不是基于pivot的luke。基于pivot的luke正在进行中,还不支持所有特性(尽管鼓励更多的测试!)
Thinlet luke on master(目前):https://github.com/dmitrykey/luke
分支上的支点卢克:https://github.com/dmitrykey/luke/tree/pivot-luke
Luke 是查询LUCENE索引文件的工具, 而且用 Luke 的Search可以做查询 Luke is a handy development and diagnostic tool, which accesses already existing Lucene indexes and allows you to display and modify their contents in seve
问题内容: 如何在括号内没有属性名称的情况下执行自定义Java注释? 我不想要这个:。我只想像在Servlet中一样,即: 问题答案: 使用名为的属性定义注释,然后可以省略属性 名称 : 可以这样使用: