diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-09-27 11:37:13 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-09-27 11:37:13 +0200 |
commit | 6b97667072635b74fdd784b132f77722b1c12be4 (patch) | |
tree | b801cb420367da166a8675de8d3f0ff0fa28eaf1 /config-model/src/test/java/com/yahoo/schema | |
parent | 373eac0314d2c916c6203d49474cf5adaa775b1c (diff) |
Simplify: Use lambda
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema')
-rw-r--r-- | config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java index 5eecee516ec..39d9be905a5 100644 --- a/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java @@ -76,6 +76,33 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { } @Test + void testInlinedComparison() throws ParseException { + RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); + ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry); + builder.addSchema("search test {\n" + + " document test { \n" + + " }\n" + + " \n" + + " rank-profile parent {\n" + + "function foo() {\n" + + " expression: 3 * bar\n" + + "}\n" + + "\n" + + "function inline bar() {\n" + + " expression: query(test) > 2.0\n" + + "}\n" + + "}\n" + + "}\n"); + builder.build(true); + Schema s = builder.getSchema(); + + RankProfile parent = rankProfileRegistry.get(s, "parent").compile(new QueryProfileRegistry(), new ImportedMlModels()); + assertEquals("3 * ( query(test) > 2.0 )", + parent.getFunctions().get("foo").function().getBody().getRoot().toString()); + + } + + @Test void testConstants() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry); |