use of org.apache.lucene.analysis.miscellaneous.LimitTokenCountAnalyzer in project jackrabbit-oak by apache.
the class IndexDefinition method createAnalyzer.
// ~---------------------------------------------------< Analyzer >
private Analyzer createAnalyzer() {
Analyzer result;
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);
}
Aggregations