summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-04-22 07:45:26 +0000
committerArne Juul <arnej@verizonmedia.com>2021-04-22 07:47:25 +0000
commit54cf8a76701363e83da3e3f39dc4ae38597d586a (patch)
tree1720a9ee80c2ba02cbcc79a9a9db7bf203b79f0e /config-model
parent7179bd7dae6aca37ae1aa061161da3d998c2644e (diff)
add unit test for argument binding resolution
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java
index 71bfddf1419..8921a5d576e 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java
@@ -195,6 +195,48 @@ public class RankingExpressionTypeResolverTestCase {
summaryFeatures(profile).get("return_b").type(profile.typeContext(builder.getQueryProfileRegistry())));
}
+ @Test
+ public void testAttributeInvocationViaBoundIdentifier() throws Exception {
+ SearchBuilder builder = new SearchBuilder();
+ builder.importString(joinLines(
+ "search newsarticle {",
+ " document newsarticle {",
+ " field title type string {",
+ " indexing {",
+ " input title | index",
+ " }",
+ " weight: 30",
+ " }",
+ " field usstaticrank type int {",
+ " indexing: summary | attribute",
+ " }",
+ " field eustaticrank type int {",
+ " indexing: summary | attribute",
+ " }",
+ " }",
+ " rank-profile default {",
+ " macro newsboost() { ",
+ " expression: 200 * matches(title)",
+ " }",
+ " macro commonboost(mystaticrank) { ",
+ " expression: attribute(mystaticrank) + newsboost",
+ " }",
+ " macro commonfirstphase(mystaticrank) { ",
+ " expression: nativeFieldMatch(title) + commonboost(mystaticrank) ",
+ " }",
+ " first-phase { expression: commonfirstphase(usstaticrank) }",
+ " }",
+ " rank-profile eurank inherits default {",
+ " first-phase { expression: commonfirstphase(eustaticrank) }",
+ " }",
+ "}"));
+ builder.build();
+ RankProfile profile = builder.getRankProfileRegistry().get(builder.getSearch(), "eurank");
+ // assertEquals(TensorType.fromSpec("tensor(x[10],y[1])"),
+ // summaryFeatures(profile).get("return_a").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ // assertEquals(TensorType.fromSpec("tensor(z[10])"),
+ // summaryFeatures(profile).get("return_b").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ }
@Test
public void testTensorFunctionInvocationTypes_NestedSameName() throws Exception {