org.apache.solr.analysis
Class ReversedWildcardFilterFactory

java.lang.Object
  extended by org.apache.lucene.analysis.util.AbstractAnalysisFactory
      extended by org.apache.lucene.analysis.util.TokenFilterFactory
          extended by org.apache.solr.analysis.ReversedWildcardFilterFactory

public class ReversedWildcardFilterFactory
extends TokenFilterFactory

Factory for ReversedWildcardFilter-s. When this factory is added to an analysis chain, it will be used both for filtering the tokens during indexing, and to determine the query processing of this field during search.

This class supports the following init arguments:

Note 1: This filter always reverses input tokens during indexing. Note 2: Query tokens without wildcard characters will never be reversed.
 <fieldType name="text_rvswc" class="solr.TextField" positionIncrementGap="100">
   <analyzer type="index">
     <tokenizer class="solr.WhitespaceTokenizerFactory"/>
     <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
             maxPosAsterisk="2" maxPosQuestion="1" minTrailing="2" maxFractionAsterisk="0"/>
   </analyzer>
   <analyzer type="query">
     <tokenizer class="solr.WhitespaceTokenizerFactory"/>
   </analyzer>
 </fieldType>


Field Summary
 
Fields inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion
 
Constructor Summary
ReversedWildcardFilterFactory(Map<String,String> args)
          Creates a new ReversedWildcardFilterFactory
 
Method Summary
 TokenStream create(TokenStream input)
           
 char getMarkerChar()
           
 boolean shouldReverse(String token)
          This method encapsulates the logic that determines whether a query token should be reversed in order to use the reversed terms in the index.
 
Methods inherited from class org.apache.lucene.analysis.util.TokenFilterFactory
availableTokenFilters, forName, lookupClass, reloadTokenFilters
 
Methods inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
assureMatchVersion, get, get, get, get, get, getBoolean, getChar, getClassArg, getFloat, getInt, getLines, getLuceneMatchVersion, getOriginalArgs, getPattern, getSet, getSnowballWordSet, getWordSet, isExplicitLuceneMatchVersion, require, require, require, requireBoolean, requireChar, requireFloat, requireInt, setExplicitLuceneMatchVersion, splitFileNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReversedWildcardFilterFactory

public ReversedWildcardFilterFactory(Map<String,String> args)
Creates a new ReversedWildcardFilterFactory

Method Detail

create

public TokenStream create(TokenStream input)
Specified by:
create in class TokenFilterFactory

shouldReverse

public boolean shouldReverse(String token)
This method encapsulates the logic that determines whether a query token should be reversed in order to use the reversed terms in the index.

Parameters:
token - input token.
Returns:
true if input token should be reversed, false otherwise.

getMarkerChar

public char getMarkerChar()


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.