Search in sources :

Example 6 with JexlNode

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;
}
Also used : JexlSelectorNode(datawave.query.language.parser.jexl.JexlSelectorNode) SlopQueryNode(org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode) JexlNode(datawave.query.language.parser.jexl.JexlNode) JexlPhraseNode(datawave.query.language.parser.jexl.JexlPhraseNode) JexlWithinNode(datawave.query.language.parser.jexl.JexlWithinNode)

Aggregations

JexlNode (datawave.query.language.parser.jexl.JexlNode)6 JexlSelectorNode (datawave.query.language.parser.jexl.JexlSelectorNode)3 JexlPhraseNode (datawave.query.language.parser.jexl.JexlPhraseNode)2 ArrayList (java.util.ArrayList)2 FieldQueryNode (org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode)2 QueryNode (org.apache.lucene.queryparser.flexible.core.nodes.QueryNode)2 UnescapedCharSequence (org.apache.lucene.queryparser.flexible.core.util.UnescapedCharSequence)2 JexlQueryFunction (datawave.query.language.functions.jexl.JexlQueryFunction)1 JexlFunctionNode (datawave.query.language.parser.jexl.JexlFunctionNode)1 JexlGroupingNode (datawave.query.language.parser.jexl.JexlGroupingNode)1 JexlWithinNode (datawave.query.language.parser.jexl.JexlWithinNode)1 EscapeQuerySyntaxImpl (datawave.query.language.parser.lucene.EscapeQuerySyntaxImpl)1 NotFoundQueryException (datawave.webservice.query.exception.NotFoundQueryException)1 LinkedList (java.util.LinkedList)1 AndQueryNode (org.apache.lucene.queryparser.flexible.core.nodes.AndQueryNode)1 BooleanQueryNode (org.apache.lucene.queryparser.flexible.core.nodes.BooleanQueryNode)1 FunctionQueryNode (org.apache.lucene.queryparser.flexible.core.nodes.FunctionQueryNode)1 FuzzyQueryNode (org.apache.lucene.queryparser.flexible.core.nodes.FuzzyQueryNode)1 GroupQueryNode (org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode)1 ModifierQueryNode (org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode)1