Search in sources :

Example 1 with FunctionNode

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

the class RankingExpressionTestCase method testIsNan.

@Test
public void testIsNan() throws ParseException {
    String strExpr = "if (isNan(attribute(foo)) == 1.0, 1.0, attribute(foo))";
    RankingExpression expr = new RankingExpression(strExpr);
    CompositeNode root = (CompositeNode) expr.getRoot();
    CompositeNode comparison = (CompositeNode) root.children().get(0);
    ExpressionNode isNan = comparison.children().get(0);
    assertTrue(isNan instanceof FunctionNode);
    assertEquals("isNan(attribute(foo))", isNan.toString());
}
Also used : CompositeNode(com.yahoo.searchlib.rankingexpression.rule.CompositeNode) ExpressionNode(com.yahoo.searchlib.rankingexpression.rule.ExpressionNode) FunctionNode(com.yahoo.searchlib.rankingexpression.rule.FunctionNode) TensorFunctionNode(com.yahoo.searchlib.rankingexpression.rule.TensorFunctionNode) Test(org.junit.Test)

Aggregations

CompositeNode (com.yahoo.searchlib.rankingexpression.rule.CompositeNode)1 ExpressionNode (com.yahoo.searchlib.rankingexpression.rule.ExpressionNode)1 FunctionNode (com.yahoo.searchlib.rankingexpression.rule.FunctionNode)1 TensorFunctionNode (com.yahoo.searchlib.rankingexpression.rule.TensorFunctionNode)1 Test (org.junit.Test)1