Class CapitalizationFilterFactory

  extended by org.apache.lucene.analysis.util.AbstractAnalysisFactory
      extended by org.apache.lucene.analysis.util.TokenFilterFactory
          extended by org.apache.lucene.analysis.miscellaneous.CapitalizationFilterFactory

public class CapitalizationFilterFactory
extends TokenFilterFactory

Factory for CapitalizationFilter.

The factory takes parameters:
"onlyFirstWord" - should each word be capitalized or all of the words?
"keep" - a keep word list. Each word that should be kept separated by whitespace.
"keepIgnoreCase - true or false. If true, the keep list will be considered case-insensitive.
"forceFirstLetter" - Force the first letter to be capitalized even if it is in the keep list
"okPrefix" - do not change word capitalization if a word begins with something in this list. for example if "McK" is on the okPrefix list, the word "McKinley" should not be changed to "Mckinley"
"minWordLength" - how long the word needs to be to get capitalization applied. If the minWordLength is 3, "and" > "And" but "or" stays "or"
"maxWordCount" - if the token contains more then maxWordCount words, the capitalization is assumed to be correct.

 <fieldType name="text_cptlztn" class="solr.TextField" positionIncrementGap="100">
     <tokenizer class="solr.WhitespaceTokenizerFactory"/>
     <filter class="solr.CapitalizationFilterFactory" onlyFirstWord="true"
           keep="java solr lucene" keepIgnoreCase="false"
           okPrefix="McK McD McA"/>   

solr 1.3

Field Summary
static String KEEP
static String KEEP_IGNORE_CASE
static String MAX_TOKEN_LENGTH
static String MAX_WORD_COUNT
static String MIN_WORD_LENGTH
static String OK_PREFIX
static String ONLY_FIRST_WORD
Fields inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
args, luceneMatchVersion
Constructor Summary
Method Summary
 CapitalizationFilter create(TokenStream input)
          Transform the specified input TokenStream
 void init(Map<String,String> args)
          Initialize this factory via a set of key-value pairs.
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, getArgs, getBoolean, getBoolean, getInt, getInt, getInt, getLines, getLuceneMatchVersion, getOriginalArgs, getPattern, getSnowballWordSet, getWordSet, setLuceneMatchVersion, splitFileNames
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final String KEEP
See Also:
Constant Field Values


public static final String KEEP_IGNORE_CASE
See Also:
Constant Field Values


public static final String OK_PREFIX
See Also:
Constant Field Values


public static final String MIN_WORD_LENGTH
See Also:
Constant Field Values


public static final String MAX_WORD_COUNT
See Also:
Constant Field Values


public static final String MAX_TOKEN_LENGTH
See Also:
Constant Field Values


public static final String ONLY_FIRST_WORD
See Also:
Constant Field Values


public static final String FORCE_FIRST_LETTER
See Also:
Constant Field Values
Constructor Detail


public CapitalizationFilterFactory()
Method Detail


public void init(Map<String,String> args)
Description copied from class: AbstractAnalysisFactory
Initialize this factory via a set of key-value pairs.

init in class AbstractAnalysisFactory


public CapitalizationFilter create(TokenStream input)
Description copied from class: TokenFilterFactory
Transform the specified input TokenStream

Specified by:
create in class TokenFilterFactory

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