Example usage for org.apache.lucene.analysis.path PathHierarchyTokenizerFactory PathHierarchyTokenizerFactory

List of usage examples for org.apache.lucene.analysis.path PathHierarchyTokenizerFactory PathHierarchyTokenizerFactory

Introduction

In this page you can find the example usage for org.apache.lucene.analysis.path PathHierarchyTokenizerFactory PathHierarchyTokenizerFactory.

Prototype

public PathHierarchyTokenizerFactory(Map<String, String> args) 

Source Link

Document

Creates a new PathHierarchyTokenizerFactory

Usage

From source file:org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition.java

License:Apache License

private Analyzer createAnalyzer() {
    Analyzer result;/*from w ww.j  a  v a  2  s  .co  m*/
    Analyzer defaultAnalyzer = LuceneIndexConstants.ANALYZER;
    if (analyzers.containsKey(LuceneIndexConstants.ANL_DEFAULT)) {
        defaultAnalyzer = analyzers.get(LuceneIndexConstants.ANL_DEFAULT);
    }
    if (!evaluatePathRestrictions()) {
        result = defaultAnalyzer;
    } else {
        Map<String, Analyzer> analyzerMap = ImmutableMap.<String, Analyzer>builder()
                .put(FieldNames.ANCESTORS,
                        new TokenizerChain(
                                new PathHierarchyTokenizerFactory(Collections.<String, String>emptyMap())))
                .build();
        result = new PerFieldAnalyzerWrapper(defaultAnalyzer, analyzerMap);
    }

    //In case of negative value no limits would be applied
    if (maxFieldLength < 0) {
        return result;
    }
    return new LimitTokenCountAnalyzer(result, maxFieldLength);
}