use of org.apache.lucene.analysis.util.CharFilterFactory in project jackrabbit-oak by apache.
the class NodeStateAnalyzerFactory method loadCharFilterFactories.
private CharFilterFactory[] loadCharFilterFactories(NodeState charFiltersState) {
List<CharFilterFactory> result = newArrayList();
//Need to read children in order
Tree tree = TreeFactory.createReadOnlyTree(charFiltersState);
for (Tree t : tree.getChildren()) {
NodeState state = charFiltersState.getChildNode(t.getName());
String factoryType = getFactoryType(state, t.getName());
Map<String, String> args = convertNodeState(state);
CharFilterFactory cf = CharFilterFactory.forName(factoryType, args);
init(cf, state);
result.add(cf);
}
return result.toArray(new CharFilterFactory[result.size()]);
}
use of org.apache.lucene.analysis.util.CharFilterFactory in project lucene-solr by apache.
the class CustomAnalyzer method toString.
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('(');
for (final CharFilterFactory filter : charFilters) {
sb.append(filter).append(',');
}
sb.append(tokenizer);
for (final TokenFilterFactory filter : tokenFilters) {
sb.append(',').append(filter);
}
return sb.append(')').toString();
}
use of org.apache.lucene.analysis.util.CharFilterFactory in project lucene-solr by apache.
the class TokenizerChain method initReaderForNormalization.
@Override
protected Reader initReaderForNormalization(String fieldName, Reader reader) {
if (charFilters != null && charFilters.length > 0) {
for (CharFilterFactory charFilter : charFilters) {
if (charFilter instanceof MultiTermAwareComponent) {
charFilter = (CharFilterFactory) ((MultiTermAwareComponent) charFilter).getMultiTermComponent();
reader = charFilter.create(reader);
}
}
}
return reader;
}
use of org.apache.lucene.analysis.util.CharFilterFactory in project lucene-solr by apache.
the class TokenizerChain method initReader.
@Override
public Reader initReader(String fieldName, Reader reader) {
if (charFilters != null && charFilters.length > 0) {
Reader cs = reader;
for (CharFilterFactory charFilter : charFilters) {
cs = charFilter.create(cs);
}
reader = cs;
}
return reader;
}
use of org.apache.lucene.analysis.util.CharFilterFactory in project lucene-solr by apache.
the class TokenizerChain method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder("TokenizerChain(");
for (CharFilterFactory filter : charFilters) {
sb.append(filter);
sb.append(", ");
}
sb.append(tokenizer);
for (TokenFilterFactory filter : filters) {
sb.append(", ");
sb.append(filter);
}
sb.append(')');
return sb.toString();
}
Aggregations