Class 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.yahoo.searchlib.rankingexpression.RankingExpression transform​(com.yahoo.searchlib.rankingexpression.RankingExpression expression, RankProfileTransformContext context)  
      com.yahoo.searchlib.rankingexpression.rule.ExpressionNode transform​(com.yahoo.searchlib.rankingexpression.rule.ExpressionNode node, RankProfileTransformContext context)  
      • Methods inherited from class com.yahoo.searchlib.rankingexpression.transform.ExpressionTransformer

        transformChildren
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FunctionShadower

        public FunctionShadower()
    • Method Detail

      • 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>