Package org.apache.lucene.analysis.path
Class PathHierarchyTokenizerFactory
java.lang.Object
org.apache.lucene.analysis.util.AbstractAnalysisFactory
org.apache.lucene.analysis.util.TokenizerFactory
org.apache.lucene.analysis.path.PathHierarchyTokenizerFactory
Factory for
PathHierarchyTokenizer.
This factory is typically configured for use only in the index
Analyzer (or only in the query Analyzer, but never both).
For example, in the configuration below a query for
Books/NonFic will match documents indexed with values like
Books/NonFic, Books/NonFic/Law,
Books/NonFic/Science/Physics, etc. But it will not match
documents indexed with values like Books, or
Books/Fic...
<fieldType name="descendent_path" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory" />
</analyzer>
</fieldType>
In this example however we see the oposite configuration, so that a query
for Books/NonFic/Science/Physics would match documents
containing Books/NonFic, Books/NonFic/Science,
or Books/NonFic/Science/Physics, but not
Books/NonFic/Science/Physics/Theory or
Books/NonFic/Law.
<fieldType name="descendent_path" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
</analyzer>
</fieldType>
- Since:
- 3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final charstatic final StringSPI nameprivate final charprivate final booleanprivate final intFields inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new PathHierarchyTokenizerFactory -
Method Summary
Modifier and TypeMethodDescriptioncreate(AttributeFactory factory) Creates a TokenStream of the specified input using the given AttributeFactoryMethods inherited from class org.apache.lucene.analysis.util.TokenizerFactory
availableTokenizers, create, findSPIName, forName, lookupClass, reloadTokenizersMethods inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
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, splitAt, splitFileNames
-
Field Details
-
NAME
SPI name- See Also:
-
delimiter
private final char delimiter -
replacement
private final char replacement -
reverse
private final boolean reverse -
skip
private final int skip
-
-
Constructor Details
-
PathHierarchyTokenizerFactory
Creates a new PathHierarchyTokenizerFactory
-
-
Method Details
-
create
Description copied from class:TokenizerFactoryCreates a TokenStream of the specified input using the given AttributeFactory- Specified by:
createin classTokenizerFactory
-