Class JapaneseCompletionFilter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Unwrappable<TokenStream>
TokenFilter
that adds Japanese romanized tokens to the term
attribute. Also, this keeps original tokens (surface forms). Main usage of this filter is Query
Auto-Completion.
Supported romanization systems: (modified) Hepburn-shiki, Kunrei-shiki (Nihon-shiki) and Wāpuro shiki.
This does not strictly comply with the romanization systems listed above, but tries to cover possible keystroke supported by various Input Methods. e.g.: Circumflex / Macron representing Chōonpu (長音符) are not supported.
The romanization behaviour changes according to its JapaneseCompletionFilter.Mode
. The default mode is JapaneseCompletionFilter.Mode.INDEX
.
Note: This filter must be applied AFTER half-width and full-width normalization. Please ensure
that a width normalizer such as CJKWidthCharFilter
or
CJKWidthFilter
is included in your analysis chain. IF THE
WIDTH NORMALIZATION IS NOT PERFORMED, THIS DOES NOT WORK AS EXPECTED. See also: JapaneseCompletionAnalyzer
.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.State
-
Field Summary
Fields inherited from class org.apache.lucene.analysis.TokenFilter
input
Fields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
-
Constructor Summary
ConstructorDescriptionCreates a newJapaneseCompletionFilter
with default configurationsCreates a newJapaneseCompletionFilter
-
Method Summary
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close, end, unwrap
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
-
Field Details
-
DEFAULT_MODE
-
-
Constructor Details
-
JapaneseCompletionFilter
Creates a newJapaneseCompletionFilter
with default configurations -
JapaneseCompletionFilter
Creates a newJapaneseCompletionFilter
-
-
Method Details
-
reset
- Overrides:
reset
in classTokenFilter
- Throws:
IOException
-
incrementToken
- Specified by:
incrementToken
in classTokenStream
- Throws:
IOException
-