org.apache.solr.analysis
Class CapitalizationFilterFactory
java.lang.Object
org.apache.solr.analysis.BaseTokenFilterFactory
org.apache.solr.analysis.CapitalizationFilterFactory
- All Implemented Interfaces:
- TokenFilterFactory
public class CapitalizationFilterFactory
- extends BaseTokenFilterFactory
A filter to apply normal capitalization rules to Tokens. It will make the first letter
capital and the rest lower case.
This filter is particularly useful to build nice looking facet parameters. This filter
is not appropriate if you intend to use a prefix query.
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.
- Since:
- solr 1.3
- Version:
- $Id: CapitalizationFilterFactory.java 804726 2009-08-16 17:28:58Z yonik $
Method Summary |
org.apache.solr.analysis.CapitalizationFilter |
create(TokenStream input)
Transform the specified input TokenStream |
void |
init(Map<String,String> args)
init will be called just once, immediately after creation. |
void |
processWord(char[] buffer,
int offset,
int length,
int wordCount)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_MAX_WORD_COUNT
public static final int DEFAULT_MAX_WORD_COUNT
- See Also:
- Constant Field Values
KEEP
public static final String KEEP
- See Also:
- Constant Field Values
KEEP_IGNORE_CASE
public static final String KEEP_IGNORE_CASE
- See Also:
- Constant Field Values
OK_PREFIX
public static final String OK_PREFIX
- See Also:
- Constant Field Values
MIN_WORD_LENGTH
public static final String MIN_WORD_LENGTH
- See Also:
- Constant Field Values
MAX_WORD_COUNT
public static final String MAX_WORD_COUNT
- See Also:
- Constant Field Values
MAX_TOKEN_LENGTH
public static final String MAX_TOKEN_LENGTH
- See Also:
- Constant Field Values
ONLY_FIRST_WORD
public static final String ONLY_FIRST_WORD
- See Also:
- Constant Field Values
FORCE_FIRST_LETTER
public static final String FORCE_FIRST_LETTER
- See Also:
- Constant Field Values
CapitalizationFilterFactory
public CapitalizationFilterFactory()
init
public void init(Map<String,String> args)
- Description copied from interface:
TokenFilterFactory
init
will be called just once, immediately after creation.
The args are user-level initialization parameters that
may be specified when declaring the factory in the
schema.xml
- Specified by:
init
in interface TokenFilterFactory
- Overrides:
init
in class BaseTokenFilterFactory
processWord
public void processWord(char[] buffer,
int offset,
int length,
int wordCount)
create
public org.apache.solr.analysis.CapitalizationFilter create(TokenStream input)
- Description copied from interface:
TokenFilterFactory
- Transform the specified input TokenStream
Copyright © 2009 Apache Software Foundation. All Rights Reserved.