use of datawave.query.language.parser.jexl.JexlNode in project datawave by NationalSecurityAgency.
the class SlopQueryNodeBuilder method build.
public JexlNode build(QueryNode queryNode) throws QueryNodeException {
JexlNode returnNode = null;
SlopQueryNode phraseSlopNode = (SlopQueryNode) queryNode;
JexlNode node = (JexlNode) phraseSlopNode.getChild().getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
if (node instanceof JexlPhraseNode) {
JexlPhraseNode phraseNode = (JexlPhraseNode) node;
returnNode = new JexlWithinNode(phraseNode.getField(), phraseNode.getWordList(), phraseSlopNode.getValue());
} else if (node instanceof JexlSelectorNode) {
// if phrase only contained one word, a JexlSelectorNode would be created
// and then a SlopQueryNode / within makes no sense
returnNode = node;
} else {
throw new UnsupportedOperationException(node.getClass().getName() + " found as a child of a SlopQueryNode -- not implemented");
}
return returnNode;
}
Aggregations