diff options
21 files changed, 96 insertions, 96 deletions
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj index 21edbb7eb58..4c1d484a932 100644 --- a/config-model/src/main/javacc/SDParser.jj +++ b/config-model/src/main/javacc/SDParser.jj @@ -1927,7 +1927,7 @@ void function(RankProfile profile) : boolean inline = false; } { - ( <MACRO> inline = inline() name = identifier() [ "$" { name = name + token.image; } ] + ( ( <FUNCTION> | <MACRO> ) inline = inline() name = identifier() [ "$" { name = name + token.image; } ] "(" [ parameter = identifier() { parameters.add(parameter); } ( <COMMA> parameter = identifier() { parameters.add(parameter); } )* ] diff --git a/config-model/src/test/derived/gemini2/gemini.sd b/config-model/src/test/derived/gemini2/gemini.sd index 18be346a758..01e20c1b30a 100644 --- a/config-model/src/test/derived/gemini2/gemini.sd +++ b/config-model/src/test/derived/gemini2/gemini.sd @@ -6,19 +6,19 @@ search gemini { rank-profile test { - macro wrapper2(x) { + function wrapper2(x) { expression: x } - macro wrapper1(x) { + function wrapper1(x) { expression: wrapper2(x) } - macro toplevel() { + function toplevel() { expression: wrapper1(attribute(right)) } - macro interfering() { + function interfering() { expression: wrapper1(attribute(wrong)) } diff --git a/config-model/src/test/examples/rankingexpressionfunction/rankingexpressionfunction.sd b/config-model/src/test/examples/rankingexpressionfunction/rankingexpressionfunction.sd index 7f09095c5e7..6e399c03a2c 100644 --- a/config-model/src/test/examples/rankingexpressionfunction/rankingexpressionfunction.sd +++ b/config-model/src/test/examples/rankingexpressionfunction/rankingexpressionfunction.sd @@ -22,11 +22,11 @@ search rankexpression { } rank-profile macros { - macro titlematch$(var1, var2) { + function titlematch$(var1, var2) { expression: file: titlematch } - macro artistmatch() { + function artistmatch() { expression: 78+closeness(distance) } diff --git a/config-model/src/test/examples/simple.sd b/config-model/src/test/examples/simple.sd index 96b0fa98098..0435ea439df 100644 --- a/config-model/src/test/examples/simple.sd +++ b/config-model/src/test/examples/simple.sd @@ -121,7 +121,7 @@ search simple { second-phase { rerank-count: 99 } - macro openTicket() { + function openTicket() { expression: if(attribute(status) == "accepted",1, if(attribute(status) == "new",1,if(attribute(status) == "reopened",1,0))) } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java index f794d1ebbcb..45d2357d742 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java @@ -59,7 +59,7 @@ public class RankingExpressionConstantsTestCase extends SearchDefinitionTestCase " constants {\n" + " p2: 2.0 \n" + " }\n" + - " macro foo() {\n" + + " function foo() {\n" + " expression: p2*p1\n" + " }\n" + " }\n" + @@ -101,7 +101,7 @@ public class RankingExpressionConstantsTestCase extends SearchDefinitionTestCase " constants {\n" + " c: 7 \n" + " }\n" + - " macro c() {\n" + + " function c() {\n" + " expression: p2*p1\n" + " }\n" + " }\n" + @@ -132,7 +132,7 @@ public class RankingExpressionConstantsTestCase extends SearchDefinitionTestCase " }\n" + " \n" + " rank-profile test {\n" + - " macro POP_SLOW_SCORE() {\n" + + " function POP_SLOW_SCORE() {\n" + " expression: safeLog(popShareSlowDecaySignal, -9.21034037)\n" + " }\n" + " }\n" + @@ -161,7 +161,7 @@ public class RankingExpressionConstantsTestCase extends SearchDefinitionTestCase " constants {\n" + " myValue: -9.21034037\n" + " }\n" + - " macro POP_SLOW_SCORE() {\n" + + " function POP_SLOW_SCORE() {\n" + " expression: safeLog(popShareSlowDecaySignal, myValue)\n" + " }\n" + " }\n" + @@ -186,7 +186,7 @@ public class RankingExpressionConstantsTestCase extends SearchDefinitionTestCase " }\n" + " \n" + " rank-profile test {\n" + - " macro rank_default(){\n" + + " function rank_default(){\n" + " expression: k1 + (k2 + k3) / 100000000.0\n\n" + " }\n" + " }\n" + @@ -212,7 +212,7 @@ public class RankingExpressionConstantsTestCase extends SearchDefinitionTestCase " }\n" + " \n" + " rank-profile test {\n" + - " macro rank_default(){\n" + + " function rank_default(){\n" + " expression: 0.5+50*(attribute(rating_yelp)-3)\n\n" + " }\n" + " }\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java index 4c3f0eaebde..e507a6c48e4 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java @@ -44,18 +44,18 @@ public class RankingExpressionInliningTestCase extends SearchDefinitionTestCase " first-phase {\n" + " expression: p1 * add\n" + " }\n" + - " macro inline add() {\n" + + " function inline add() {\n" + " expression: 3 + attribute(a) + attribute(b) * mul3\n" + " }\n" + - " macro inline mul3() {\n" + + " function inline mul3() {\n" + " expression: attribute(a) * 3 + singleif\n" + " }\n" + - " macro inline singleif() {\n" + + " function inline singleif() {\n" + " expression: if (p1 < attribute(a), 1, 2) == 0\n" + " }\n" + " }\n" + " rank-profile child inherits parent {\n" + - " macro inline add() {\n" + + " function inline add() {\n" + " expression: 9 + attribute(a)\n" + " }\n" + " }\n" + @@ -95,7 +95,7 @@ public class RankingExpressionInliningTestCase extends SearchDefinitionTestCase " second-phase {\n" + " expression: p2 * foo\n" + " }\n" + - " macro inline foo() {\n" + + " function inline foo() {\n" + " expression: 3 + p1 + p2\n" + " }\n" + " }\n" + @@ -106,16 +106,16 @@ public class RankingExpressionInliningTestCase extends SearchDefinitionTestCase " constants {\n" + " p2: 2.0 \n" + " }\n" + - " macro bar() {\n" + + " function bar() {\n" + " expression: p2*p1\n" + " }\n" + - " macro inline baz() {\n" + + " function inline baz() {\n" + " expression: p2+p1+boz\n" + " }\n" + - " macro inline boz() {\n" + + " function inline boz() {\n" + " expression: 3.0\n" + " }\n" + - " macro inline arg(a1) {\n" + + " function inline arg(a1) {\n" + " expression: a1*2\n" + " }\n" + " }\n" + @@ -162,16 +162,16 @@ public class RankingExpressionInliningTestCase extends SearchDefinitionTestCase " first-phase {\n" + " expression: A + C + D\n" + " }\n" + - " macro inline D() {\n" + + " function inline D() {\n" + " expression: B + 1\n" + " }\n" + - " macro C() {\n" + + " function C() {\n" + " expression: A + B\n" + " }\n" + - " macro inline B() {\n" + + " function inline B() {\n" + " expression: attribute(b)\n" + " }\n" + - " macro inline A() {\n" + + " function inline A() {\n" + " expression: attribute(a)\n" + " }\n" + " }\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java index df9a40d29e2..17bebcba70e 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java @@ -29,7 +29,7 @@ public class RankingExpressionLoopDetectionTestCase { " first-phase {\n" + " expression: foo\n" + " }\n" + - " macro foo() {\n" + + " function foo() {\n" + " expression: foo\n" + " }\n" + " }\n" + @@ -61,10 +61,10 @@ public class RankingExpressionLoopDetectionTestCase { " first-phase {\n" + " expression: foo\n" + " }\n" + - " macro foo() {\n" + + " function foo() {\n" + " expression: arg(5)\n" + " }\n" + - " macro arg(a1) {\n" + + " function arg(a1) {\n" + " expression: foo + a1*2\n" + " }\n" + " }\n" + @@ -96,10 +96,10 @@ public class RankingExpressionLoopDetectionTestCase { " first-phase {\n" + " expression: foo\n" + " }\n" + - " macro foo() {\n" + + " function foo() {\n" + " expression: arg(foo)\n" + " }\n" + - " macro arg(a1) {\n" + + " function arg(a1) {\n" + " expression: a1*2\n" + " }\n" + " }\n" + @@ -131,10 +131,10 @@ public class RankingExpressionLoopDetectionTestCase { " first-phase {\n" + " expression: foo(3)\n" + " }\n" + - " macro foo(a1) {\n" + + " function foo(a1) {\n" + " expression: bar(3)\n" + " }\n" + - " macro bar(a1) {\n" + + " function bar(a1) {\n" + " expression: a1*2\n" + " }\n" + " }\n" + @@ -159,10 +159,10 @@ public class RankingExpressionLoopDetectionTestCase { " first-phase {\n" + " expression: foo(3)\n" + " }\n" + - " macro foo(a1) {\n" + + " function foo(a1) {\n" + " expression: bar(3) + bar(a1)\n" + " }\n" + - " macro bar(a1) {\n" + + " function bar(a1) {\n" + " expression: a1*2\n" + " }\n" + " }\n" + @@ -183,10 +183,10 @@ public class RankingExpressionLoopDetectionTestCase { " first-phase {\n" + " expression: foo(bar(2))\n" + " }\n" + - " macro foo(x) {\n" + + " function foo(x) {\n" + " expression: x * x\n" + " }\n" + - " macro bar(x) {\n" + + " function bar(x) {\n" + " expression: x + x\n" + " }\n" + " }\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java index fe827113525..e15d4075b19 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java @@ -31,7 +31,7 @@ public class RankingExpressionShadowingTestCase extends SearchDefinitionTestCase " }\n" + " \n" + " rank-profile test {\n" + - " macro sin(x) {\n" + + " function sin(x) {\n" + " expression: x * x\n" + " }\n" + " first-phase {\n" + @@ -69,13 +69,13 @@ public class RankingExpressionShadowingTestCase extends SearchDefinitionTestCase " }\n" + " \n" + " rank-profile test {\n" + - " macro tan(x) {\n" + + " function tan(x) {\n" + " expression: x * x\n" + " }\n" + - " macro cos(x) {\n" + + " function cos(x) {\n" + " expression: tan(x)\n" + " }\n" + - " macro sin(x) {\n" + + " function sin(x) {\n" + " expression: cos(x)\n" + " }\n" + " first-phase {\n" + @@ -125,7 +125,7 @@ public class RankingExpressionShadowingTestCase extends SearchDefinitionTestCase " }\n" + " \n" + " rank-profile test {\n" + - " macro sin(x) {\n" + + " function sin(x) {\n" + " expression: x * x\n" + " }\n" + " first-phase {\n" + @@ -168,13 +168,13 @@ public class RankingExpressionShadowingTestCase extends SearchDefinitionTestCase " }\n" + " \n" + " rank-profile test {\n" + - " macro relu(x) {\n" + // relu is a built in function, redefined here + " function relu(x) {\n" + // relu is a built in function, redefined here " expression: max(1.0, x)\n" + " }\n" + - " macro hidden_layer() {\n" + + " function hidden_layer() {\n" + " expression: relu(sum(query(q) * constant(W_hidden), input) + constant(b_input))\n" + " }\n" + - " macro final_layer() {\n" + + " function final_layer() {\n" + " expression: sigmoid(sum(hidden_layer * constant(W_final), hidden) + constant(b_final))\n" + " }\n" + " second-phase {\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeValidatorTestCase.java index 531ca194c20..0d8cbbf2e6a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeValidatorTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeValidatorTestCase.java @@ -123,7 +123,7 @@ public class RankingExpressionTypeValidatorTestCase { " }", " }", " rank-profile my_rank_profile {", - " macro macro1(attribute_to_use) {", + " function macro1(attribute_to_use) {", " expression: attribute(attribute_to_use)", " }", " summary-features {", @@ -156,16 +156,16 @@ public class RankingExpressionTypeValidatorTestCase { " }", " }", " rank-profile my_rank_profile {", - " macro return_a() {", + " function return_a() {", " expression: return_first(attribute(a), attribute(b))", " }", - " macro return_b() {", + " function return_b() {", " expression: return_second(attribute(a), attribute(b))", " }", - " macro return_first(e1, e2) {", + " function return_first(e1, e2) {", " expression: e1", " }", - " macro return_second(e1, e2) {", + " function return_second(e1, e2) {", " expression: return_first(e2, e1)", " }", " summary-features {", diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java index 54ccbd5d193..8944409e1e9 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java @@ -216,10 +216,10 @@ public class RankingExpressionWithOnnxTestCase { public void testImportingFromStoredExpressionsWithFunctionOverridingConstant() throws IOException { String rankProfile = " rank-profile my_profile {\n" + - " macro Placeholder() {\n" + + " function Placeholder() {\n" + " expression: tensor(d0[2],d1[784])(0.0)\n" + " }\n" + - " macro " + name + "_Variable() {\n" + + " function " + name + "_Variable() {\n" + " expression: tensor(d1[10],d2[784])(0.0)\n" + " }\n" + " first-phase {\n" + @@ -234,7 +234,7 @@ public class RankingExpressionWithOnnxTestCase { search.compileRankProfile("my_profile", applicationDir.append("models")); search.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile"); - assertNull("Constant overridden by macro is not added", + assertNull("Constant overridden by function is not added", search.search().rankingConstants().get( name + "_Variable")); // At this point the expression is stored - copy application to another location which do not have a models dir @@ -247,7 +247,7 @@ public class RankingExpressionWithOnnxTestCase { RankProfileSearchFixture searchFromStored = uncompiledFixtureWith(rankProfile, storedApplication); searchFromStored.compileRankProfile("my_profile", applicationDir.append("models")); searchFromStored.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile"); - assertNull("Constant overridden by macro is not added", + assertNull("Constant overridden by function is not added", searchFromStored.search().rankingConstants().get( name + "_Variable")); } finally { IOUtils.recursiveDeleteDir(storedApplicationDirectory.toFile()); @@ -286,7 +286,7 @@ public class RankingExpressionWithOnnxTestCase { application, application.getQueryProfiles(), " rank-profile my_profile {\n" + - " macro " + functionName + "() {\n" + + " function " + functionName + "() {\n" + " expression: " + functionExpression + " }\n" + " first-phase {\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java index 970df5b858a..2460e70bd8b 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java @@ -264,10 +264,10 @@ public class RankingExpressionWithTensorFlowTestCase { public void testImportingFromStoredExpressionsWithFunctionOverridingConstantAndInheritance() throws IOException { String rankProfiles = " rank-profile my_profile {\n" + - " macro Placeholder() {\n" + + " function Placeholder() {\n" + " expression: tensor(d0[2],d1[784])(0.0)\n" + " }\n" + - " macro " + name + "_layer_Variable_read() {\n" + + " function " + name + "_layer_Variable_read() {\n" + " expression: tensor(d1[10],d2[784])(0.0)\n" + " }\n" + " first-phase {\n" + @@ -285,7 +285,7 @@ public class RankingExpressionWithTensorFlowTestCase { search.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile"); search.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile_child"); - assertNull("Constant overridden by macro is not added", + assertNull("Constant overridden by function is not added", search.search().rankingConstants().get("mnist_softmax_saved_layer_Variable_read")); // At this point the expression is stored - copy application to another location which do not have a models dir @@ -300,7 +300,7 @@ public class RankingExpressionWithTensorFlowTestCase { searchFromStored.compileRankProfile("my_profile_child", applicationDir.append("models")); searchFromStored.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile"); searchFromStored.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile_child"); - assertNull("Constant overridden by macro is not added", + assertNull("Constant overridden by function is not added", searchFromStored.search().rankingConstants().get("mnist_softmax_saved_layer_Variable_read")); } finally { @@ -339,7 +339,7 @@ public class RankingExpressionWithTensorFlowTestCase { final String name = "mnist_saved"; final String rankProfiles = " rank-profile my_profile {\n" + - " macro input() {\n" + + " function input() {\n" + " expression: tensor(d0[1],d1[784])(0.0)\n" + " }\n" + " first-phase {\n" + @@ -440,7 +440,7 @@ public class RankingExpressionWithTensorFlowTestCase { application, application.getQueryProfiles(), " rank-profile my_profile {\n" + - " macro " + functionName + "() {\n" + + " function " + functionName + "() {\n" + " expression: " + functionExpression + " }\n" + " first-phase {\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java index e3d6b3a3ef2..48f2bf43e81 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java @@ -98,7 +98,7 @@ public class RankingExpressionWithTensorTestCase { public void requireThatConstantTensorsCanBeUsedInFunction() throws ParseException { RankProfileSearchFixture f = new RankProfileSearchFixture( " rank-profile my_profile {\n" + - " macro my_macro() {\n" + + " function my_macro() {\n" + " expression: sum(my_tensor)\n" + " }\n" + " first-phase {\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java index 8ce2c483387..b39c48b67bf 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java @@ -32,10 +32,10 @@ public class ReservedRankingExpressionFunctionNamesTestCase { " }\n" + " \n" + " rank-profile test_rank_profile {\n" + - " macro not_a_reserved_name(x) {\n" + + " function not_a_reserved_name(x) {\n" + " expression: x + x\n" + " }\n" + - " macro sigmoid(x) {\n" + + " function sigmoid(x) {\n" + " expression: x * x\n" + " }\n" + " first-phase {\n" + @@ -43,7 +43,7 @@ public class ReservedRankingExpressionFunctionNamesTestCase { " }\n" + " }\n" + " rank-profile test_rank_profile_2 inherits test_rank_profile {\n" + - " macro sin(x) {\n" + + " function sin(x) {\n" + " expression: x * x\n" + " }\n" + " first-phase {\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java index 54eb7da49b4..8e721dbe503 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java @@ -171,7 +171,7 @@ public class TensorTransformTestCase extends SearchDefinitionTestCase { " value: { {x:0}:0 }\n" + " }\n" + " }\n" + - " macro base_tensor() {\n" + + " function base_tensor() {\n" + " expression: constant(base_constant_tensor)\n" + " }\n" + " }\n" + @@ -181,19 +181,19 @@ public class TensorTransformTestCase extends SearchDefinitionTestCase { " value: { {x:0}:1 }\n" + " }\n" + " }\n" + - " macro returns_tensor_with_arg(arg1) {\n" + + " function returns_tensor_with_arg(arg1) {\n" + " expression: 2.0 * arg1\n" + " }\n" + - " macro wraps_returns_tensor() {\n" + + " function wraps_returns_tensor() {\n" + " expression: returns_tensor\n" + " }\n" + - " macro returns_tensor() {\n" + + " function returns_tensor() {\n" + " expression: attribute(tensor_field_2)\n" + " }\n" + - " macro tensor_inheriting() {\n" + + " function tensor_inheriting() {\n" + " expression: base_tensor\n" + " }\n" + - " macro testexpression() {\n" + + " function testexpression() {\n" + " expression: " + expression + "\n" + " }\n" + " }\n" + diff --git a/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java b/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java index d2fca309a19..7bea2d0825a 100644 --- a/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java +++ b/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java @@ -81,11 +81,11 @@ public class RankProfilesConfigImporter { referencedFunctions.put(reference.get(), new ExpressionFunction(reference.get().serialForm(), arguments, expression)); } - else if (property.name().equals("vespa.rank.firstphase")) { // Include in addition to macros + else if (property.name().equals("vespa.rank.firstphase")) { // Include in addition to functions firstPhase = new ExpressionFunction("firstphase", new ArrayList<>(), new RankingExpression("first-phase", property.value())); } - else if (property.name().equals("vespa.rank.secondphase")) { // Include in addition to macros + else if (property.name().equals("vespa.rank.secondphase")) { // Include in addition to functions secondPhase = new ExpressionFunction("secondphase", new ArrayList<>(), new RankingExpression("second-phase", property.value())); } diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java index ed82ba20fbe..722520fea08 100755 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java @@ -250,12 +250,12 @@ public class RankingExpression implements Serializable { /** * Creates the necessary rank properties required to implement this expression. * - * @param macros the expression macros to expand. - * @return a list of named rank properties required to implement this expression. + * @param functions the expression functions to expand + * @return a list of named rank properties required to implement this expression */ - public Map<String, String> getRankProperties(List<ExpressionFunction> macros) { + public Map<String, String> getRankProperties(List<ExpressionFunction> functions) { Deque<String> path = new LinkedList<>(); - SerializationContext context = new SerializationContext(macros); + SerializationContext context = new SerializationContext(functions); String serializedRoot = root.toString(new StringBuilder(), context, path, null).toString(); Map<String, String> serializedExpressions = context.serializedFunctions(); serializedExpressions.put(propertyName(name), serializedRoot); diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java index 8653e05a7d2..282a4c5e0a9 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java @@ -30,8 +30,8 @@ public class ImportedModel { private final Map<String, Tensor> smallConstants = new HashMap<>(); private final Map<String, Tensor> largeConstants = new HashMap<>(); private final Map<String, RankingExpression> expressions = new HashMap<>(); - private final Map<String, RankingExpression> macros = new HashMap<>(); - private final Map<String, TensorType> requiredMacros = new HashMap<>(); + private final Map<String, RankingExpression> functions = new HashMap<>(); + private final Map<String, TensorType> requiredFunctions = new HashMap<>(); /** * Creates a new imported model. @@ -77,13 +77,13 @@ public class ImportedModel { public Map<String, RankingExpression> expressions() { return Collections.unmodifiableMap(expressions); } /** - * Returns an immutable map of macros that are part of this model. - * Note that the macros themselves are *not* copies and *not* immutable - they must be copied before modification. + * Returns an immutable map of the functions that are part of this model. + * Note that the functions themselves are *not* copies and *not* immutable - they must be copied before modification. */ - public Map<String, RankingExpression> functions() { return Collections.unmodifiableMap(macros); } + public Map<String, RankingExpression> functions() { return Collections.unmodifiableMap(functions); } - /** Returns an immutable map of the macros that must be provided by the environment running this model */ - public Map<String, TensorType> requiredFunctions() { return Collections.unmodifiableMap(requiredMacros); } + /** Returns an immutable map of the functions that must be provided by the environment running this model */ + public Map<String, TensorType> requiredFunctions() { return Collections.unmodifiableMap(requiredFunctions); } /** Returns an immutable map of the signatures of this */ public Map<String, Signature> signatures() { return Collections.unmodifiableMap(signatures); } @@ -100,8 +100,8 @@ public class ImportedModel { void smallConstant(String name, Tensor constant) { smallConstants.put(name, constant); } void largeConstant(String name, Tensor constant) { largeConstants.put(name, constant); } void expression(String name, RankingExpression expression) { expressions.put(name, expression); } - void macro(String name, RankingExpression expression) { macros.put(name, expression); } - void requiredMacro(String name, TensorType type) { requiredMacros.put(name, type); } + void function(String name, RankingExpression expression) { functions.put(name, expression); } + void requiredFunction(String name, TensorType type) { requiredFunctions.put(name, type); } /** * Returns all the output expressions of this indexed by name. The names consist of one or two parts diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ModelImporter.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ModelImporter.java index 2ae107a5770..17352aea01e 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ModelImporter.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ModelImporter.java @@ -24,7 +24,7 @@ import java.util.logging.Logger; * ranking expressions. The general mechanism for import is for the * specific ML platform import implementations to create an * IntermediateGraph. This class offers common code to convert the - * IntermediateGraph to Vespa ranking expressions and macros. + * IntermediateGraph to Vespa ranking expressions and functions. * * @author lesters */ @@ -122,7 +122,7 @@ public abstract class ModelImporter { importExpressionInputs(operation, model); importRankingExpression(operation, model); importArgumentExpression(operation, model); - importMacroExpression(operation, model); + importFunctionExpression(operation, model); return operation.function(); } @@ -188,15 +188,15 @@ public abstract class ModelImporter { // All inputs must have dimensions with standard naming convention: d0, d1, ... OrderedTensorType standardNamingConvention = OrderedTensorType.standardType(operation.type().get()); model.argument(operation.vespaName(), standardNamingConvention.type()); - model.requiredMacro(operation.vespaName(), standardNamingConvention.type()); + model.requiredFunction(operation.vespaName(), standardNamingConvention.type()); } } - private static void importMacroExpression(IntermediateOperation operation, ImportedModel model) { + private static void importFunctionExpression(IntermediateOperation operation, ImportedModel model) { if (operation.macro().isPresent()) { TensorFunction function = operation.macro().get(); try { - model.macro(operation.macroName(), new RankingExpression(operation.macroName(), function.toString())); + model.function(operation.macroName(), new RankingExpression(operation.macroName(), function.toString())); } catch (ParseException e) { throw new RuntimeException("Tensorflow function " + function + diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/IntermediateOperation.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/IntermediateOperation.java index 43de29cedd5..da1445b885c 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/IntermediateOperation.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/IntermediateOperation.java @@ -86,7 +86,7 @@ public abstract class IntermediateOperation { /** Return unmodifiable list of inputs */ public List<IntermediateOperation> inputs() { return inputs; } - /** Return unmodifiable list of outputs. If a node has multiple outputs, consider adding a macro. */ + /** Return unmodifiable list of outputs. If a node has multiple outputs, consider adding a function. */ public List<IntermediateOperation> outputs() { return Collections.unmodifiableList(outputs); } /** Returns a Vespa ranking expression that should be added as a macro */ diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/PlaceholderWithDefault.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/PlaceholderWithDefault.java index 9299ae9be12..384c4b1c4a8 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/PlaceholderWithDefault.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/importer/operations/PlaceholderWithDefault.java @@ -26,7 +26,7 @@ public class PlaceholderWithDefault extends IntermediateOperation { if (!allInputFunctionsPresent(1)) { return null; } - // This should be a call to the macro we add below, but for now + // This should be a call to the function we add below, but for now // we treat this as as identity function and just pass the constant. return inputs.get(0).function().orElse(null); } @@ -42,7 +42,7 @@ public class PlaceholderWithDefault extends IntermediateOperation { @Override public boolean isConstant() { - return true; // not true if we add to macro + return true; // not true if we add to function } } diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java index e2dc170c168..2a5f1646391 100755 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java @@ -15,7 +15,7 @@ import java.util.Deque; import java.util.List; /** - * A node referring either to a value in the context or to a named ranking expression (function aka macro). + * A node referring either to a value in the context or to a named ranking expression function. * * @author bratseth */ |