use of org.apache.jena.query.text.analyzer.ConfigurableAnalyzer in project jena by apache.
the class ConfigurableAnalyzerAssembler method open.
/*
text:map (
[ text:field "text" ;
text:predicate rdfs:label;
text:analyzer [
a text:ConfigurableAnalyzer ;
text:tokenizer text:LetterTokenizer ;
text:filters (text:LowerCaseFilter)
]
]
.
*/
@Override
public Analyzer open(Assembler a, Resource root, Mode mode) {
if (root.hasProperty(TextVocab.pTokenizer)) {
Resource tokenizerResource = root.getPropertyResourceValue(TextVocab.pTokenizer);
String tokenizer = tokenizerResource.getLocalName();
List<String> filters;
if (root.hasProperty(TextVocab.pFilters)) {
Resource filtersResource = root.getPropertyResourceValue(TextVocab.pFilters);
filters = toFilterList(filtersResource);
} else {
filters = new ArrayList<>();
}
return new ConfigurableAnalyzer(tokenizer, filters);
} else {
throw new TextIndexException("text:tokenizer setting is required by ConfigurableAnalyzer");
}
}
Aggregations