Java 类org.apache.lucene.analysis.core.TypeTokenFilter 实例源码

项目:querqy    文件:AnalyzingQuerqyParserTest.java   
@Before
public void createAnalyzers() throws Exception {
   queryAnalyzer = new Analyzer() {
      @Override
      protected TokenStreamComponents createComponents(String fieldName) {
         // White space tokenizer, to lower case tokenizer.
         return new TokenStreamComponents(new MockTokenizer());
      }
   };

   SynonymMap.Builder builder = new SynonymMap.Builder(true);
   builder.add(new CharsRef("test"), new CharsRef("synonym1"), false);
   builder.add(new CharsRef("test"), new CharsRef("synonym2"), false);
   final SynonymMap synonyms = builder.build();

   synonymAnalyzer = new Analyzer() {
      @Override
      protected TokenStreamComponents createComponents(String fieldName) {
         // White space tokenizer, to lower case tokenizer.
         MockTokenizer tokenizer = new MockTokenizer();
         // Filter for adding synonyms
         TokenStream result = new SynonymFilter(tokenizer, synonyms, true);
         // Filter all non-synonyms, because the synonym filter outputs the
         // original token too.
         result = new TypeTokenFilter(result, Collections.singleton(SynonymFilter.TYPE_SYNONYM),
               true);
         return new TokenStreamComponents(tokenizer, result);
      }
   };
}
项目:elasticsearch_my    文件:KeepTypesFilterFactory.java   
@Override
public TokenStream create(TokenStream tokenStream) {
    return new TypeTokenFilter(tokenStream, keepTypes, true);
}
项目:Elasticsearch    文件:KeepTypesFilterFactory.java   
@Override
public TokenStream create(TokenStream tokenStream) {
    return new TypeTokenFilter(tokenStream, keepTypes, true);
}
项目:NYBC    文件:TypeTokenFilterFactory.java   
@Override
public TokenStream create(TokenStream input) {
  return new TypeTokenFilter(enablePositionIncrements, input, stopTypes, useWhitelist);
}