问题
The Solr documentation for creating your own token and character filters says the following.
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#Specifying_an_Analyzer_in_the_schema
If you want to use custom CharFilters, Tokenizers or TokenFilters, you'll need to write a very simple factory that subclasses BaseTokenizerFactory or BaseTokenFilterFactory, something like this...
public class MyCustomFilterFactory extends BaseTokenFilterFactory {
public TokenStream create(TokenStream input) {
return new MyCustomFilter(input);
}
}
I cannot find the BaseTokenFilterFactory anywhere in the source code for Solr 4.
Here is the org.apache.solr.analysis package from Solr 3.6.1
http://svn.apache.org/viewvc/lucene/dev/tags/lucene_solr_3_6_1/solr/core/src/java/org/apache/solr/analysis/
And here is the same package for Solr 4.0.0
http://svn.apache.org/viewvc/lucene/dev/tags/lucene_solr_4_0_0/solr/core/src/java/org/apache/solr/analysis/
The documentation looks like it will work for Solr 3.6, but I need to know how to create custom filters using 4.0.
回答1:
With solr 4.0 the BaseTokenFilterFactory
is now org.apache.lucene.analysis.util.TokenFilterFactory
, so you can check on this.
来源:https://stackoverflow.com/questions/13149627/where-did-basetokenfilterfactory-go-in-solr-4-0