本文整理汇总了Java中org.apache.lucene.search.suggest.analyzing.SuggestStopFilter类的典型用法代码示例。如果您正苦于以下问题:Java SuggestStopFilter类的具体用法?Java SuggestStopFilter怎么用?Java SuggestStopFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SuggestStopFilter类属于org.apache.lucene.search.suggest.analyzing包,在下文中一共展示了SuggestStopFilter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.apache.lucene.search.suggest.analyzing.SuggestStopFilter; //导入依赖的package包/类
@Override
public TokenStream create(TokenStream tokenStream) {
if (removeTrailing) {
return new StopFilter(tokenStream, stopWords);
} else {
return new SuggestStopFilter(tokenStream, stopWords);
}
}
示例2: testThatSuggestStopFilterWorks
import org.apache.lucene.search.suggest.analyzing.SuggestStopFilter; //导入依赖的package包/类
public void testThatSuggestStopFilterWorks() throws Exception {
Settings settings = Settings.builder()
.put("index.analysis.filter.my_stop.type", "stop")
.put("index.analysis.filter.my_stop.remove_trailing", false)
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
.build();
ESTestCase.TestAnalysis analysis = AnalysisTestsHelper.createTestAnalysisFromSettings(settings);
TokenFilterFactory tokenFilter = analysis.tokenFilter.get("my_stop");
assertThat(tokenFilter, instanceOf(StopTokenFilterFactory.class));
Tokenizer tokenizer = new WhitespaceTokenizer();
tokenizer.setReader(new StringReader("foo an"));
TokenStream create = tokenFilter.create(tokenizer);
assertThat(create, instanceOf(SuggestStopFilter.class));
}
示例3: create
import org.apache.lucene.search.suggest.analyzing.SuggestStopFilter; //导入依赖的package包/类
@Override
public TokenStream create(TokenStream tokenStream) {
if (removeTrailing) {
if (version.onOrAfter(Version.LUCENE_4_4)) {
return new StopFilter(tokenStream, stopWords);
} else {
return new Lucene43StopFilter(enablePositionIncrements, tokenStream, stopWords);
}
} else {
return new SuggestStopFilter(tokenStream, stopWords);
}
}
示例4: create
import org.apache.lucene.search.suggest.analyzing.SuggestStopFilter; //导入依赖的package包/类
@Override
public TokenStream create(final TokenStream tokenStream) {
if (removeTrailing) {
return new StopFilter(tokenStream, stopWords);
} else {
return new SuggestStopFilter(tokenStream, stopWords);
}
}