public class PathHierarchyTokenizerFactory extends TokenizerFactory
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>
Modifier and Type | Field and Description |
---|---|
static String |
NAME
SPI name
|
LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion
Constructor and Description |
---|
PathHierarchyTokenizerFactory(Map<String,String> args)
Creates a new PathHierarchyTokenizerFactory
|
Modifier and Type | Method and Description |
---|---|
Tokenizer |
create(AttributeFactory factory)
Creates a TokenStream of the specified input using the given AttributeFactory
|
availableTokenizers, create, findSPIName, forName, lookupClass, reloadTokenizers
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
public static final String NAME
public Tokenizer create(AttributeFactory factory)
TokenizerFactory
create
in class TokenizerFactory
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.