Search in sources :

Example 21 with ExpressionNode

use of com.yahoo.searchlib.rankingexpression.rule.ExpressionNode in project vespa by vespa-engine.

the class AbstractArrayContext method extractVariables.

private void extractVariables(ExpressionNode node, Set<String> variables) {
    if (node instanceof ReferenceNode) {
        ReferenceNode fNode = (ReferenceNode) node;
        if (fNode.getArguments().expressions().size() > 0)
            throw new UnsupportedOperationException("Array lookup is not supported with features having arguments)");
        variables.add(fNode.toString());
    } else if (node instanceof CompositeNode) {
        CompositeNode cNode = (CompositeNode) node;
        for (ExpressionNode child : cNode.children()) extractVariables(child, variables);
    }
}
Also used : CompositeNode(com.yahoo.searchlib.rankingexpression.rule.CompositeNode) ReferenceNode(com.yahoo.searchlib.rankingexpression.rule.ReferenceNode) ExpressionNode(com.yahoo.searchlib.rankingexpression.rule.ExpressionNode)

Aggregations

ExpressionNode (com.yahoo.searchlib.rankingexpression.rule.ExpressionNode)21 TensorType (com.yahoo.tensor.TensorType)8 ArrayList (java.util.ArrayList)7 DoubleValue (com.yahoo.searchlib.rankingexpression.evaluation.DoubleValue)6 ConstantNode (com.yahoo.searchlib.rankingexpression.rule.ConstantNode)6 ReferenceNode (com.yahoo.searchlib.rankingexpression.rule.ReferenceNode)6 TensorFunctionNode (com.yahoo.searchlib.rankingexpression.rule.TensorFunctionNode)5 OrderedTensorType (com.yahoo.searchlib.rankingexpression.integration.tensorflow.importer.OrderedTensorType)4 ArithmeticNode (com.yahoo.searchlib.rankingexpression.rule.ArithmeticNode)4 CompositeNode (com.yahoo.searchlib.rankingexpression.rule.CompositeNode)4 GeneratorLambdaFunctionNode (com.yahoo.searchlib.rankingexpression.rule.GeneratorLambdaFunctionNode)4 Generate (com.yahoo.tensor.functions.Generate)4 ArithmeticOperator (com.yahoo.searchlib.rankingexpression.rule.ArithmeticOperator)3 Reduce (com.yahoo.tensor.functions.Reduce)3 TensorFunction (com.yahoo.tensor.functions.TensorFunction)3 RankingExpression (com.yahoo.searchlib.rankingexpression.RankingExpression)2 RankProfile (com.yahoo.searchdefinition.RankProfile)1 Reference (com.yahoo.searchlib.rankingexpression.Reference)1 Value (com.yahoo.searchlib.rankingexpression.evaluation.Value)1 ComparisonNode (com.yahoo.searchlib.rankingexpression.rule.ComparisonNode)1