Class FunctionShadower

java.lang.Object
com.yahoo.searchlib.rankingexpression.transform.ExpressionTransformer<RankProfileTransformContext>
com.yahoo.schema.expressiontransforms.FunctionShadower

public class FunctionShadower extends com.yahoo.searchlib.rankingexpression.transform.ExpressionTransformer<RankProfileTransformContext>
Transforms function nodes to reference nodes if a rank profile function shadows a built-in function. This has the effect of allowing rank profile functions to redefine built-in functions. Another effect is that we can add built-in functions over time without fear of breaking existing users' functions with the same name. However, there is a (largish) caveat. If a user has a function with a certain number of arguments, and we add in a built-in function with a different arity, this will cause parse errors as the Java parser gives precedence to built-in functions.
Author:
lesters
  • Constructor Details

    • FunctionShadower

      public FunctionShadower()
  • Method Details

    • transform

      public com.yahoo.searchlib.rankingexpression.RankingExpression transform(com.yahoo.searchlib.rankingexpression.RankingExpression expression, RankProfileTransformContext context)
      Overrides:
      transform in class com.yahoo.searchlib.rankingexpression.transform.ExpressionTransformer<RankProfileTransformContext>
    • transform

      public com.yahoo.searchlib.rankingexpression.rule.ExpressionNode transform(com.yahoo.searchlib.rankingexpression.rule.ExpressionNode node, RankProfileTransformContext context)
      Specified by:
      transform in class com.yahoo.searchlib.rankingexpression.transform.ExpressionTransformer<RankProfileTransformContext>