Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The following page has been changed by HossMan:
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters

The comment on the change is:
expanding based on Grant's questions: package name aliasing & custom analizers

------------------------------------------------------------------------------
  
  == Specifying an Analyzer in the schema ==
  
- A SOLR schema.xml file allows two methods for specifying they way a text 
field is analyzed. (Normally only fieldtypes of `solr.TextField` will have 
Analyzers explicitly specified in the schema): 
+ A Solr schema.xml file allows two methods for specifying they way a text 
field is analyzed. (Normally only fieldtypes of `solr.TextField` will have 
Analyzers explicitly specified in the schema): 
  
    1.  Specifying the '''class name''' of an Analyzer — anything 
extending org.apache.lucene.analysis.Analyzer. [[BR]] Example: [[BR]] {{{
  <fieldtype name="nametext" class="solr.TextField">
    <analyzer class="org.apache.lucene.analysis.WhitespaceAnalyzer"/>
  </fieldtype>
  }}}
-   1.  Specifing a '''Tokenizer''' followed by a list of optional 
!TokenFilters that are applied in the listed order. Factories that can create 
the tokenizers or token filters are used to prepare configuration for the 
tokenizer or filter and avoid the overhead of creation via reflection. [[BR]] 
Example: [[BR]] {{{
+   1.  Specifing a '''TokenizerFactory''' followed by a list of optional 
!TokenFilterFactories that are applied in the listed order. Factories that can 
create the tokenizers or token filters are used to prepare configuration for 
the tokenizer or filter and avoid the overhead of creation via reflection. 
[[BR]] Example: [[BR]] {{{
  <fieldtype name="text" class="solr.TextField">
    <analyzer>
      <tokenizer class="solr.StandardTokenizerFactory"/>
@@ -52, +52 @@

    </analyzer>
  </fieldtype>
  }}}
+ 
+ Any Analyzer, !TokenizerFactory, or !TokenFilterFactory may be specified 
using it's full class name with package -- just make sure they are in Solr's 
classpath when you start your appserver.  Classes in the 
"`org.apache.solr.analysis.*`" package can be referenced using the short alias 
"`solr.*`".
+ 
+ If you want to use custom 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);
+   }
+ }
+ }}}
+ 
  
  === TokenizerFactories ===
  

Reply via email to