Class MapEvaluationTypeContext

  • All Implemented Interfaces:
    com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>

    public class MapEvaluationTypeContext
    extends com.yahoo.searchlib.rankingexpression.rule.FunctionReferenceContext
    implements com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
    A context which only contains type information. This returns empty tensor types (double) for unknown features which are not query, attribute or constant features, as we do not have information about which such features exist (but we know those that exist are doubles). This is not multithread safe.
    Author:
    bratseth
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.yahoo.tensor.TensorType defaultTypeOf​(com.yahoo.searchlib.rankingexpression.Reference reference)
      Returns the default type for this simple feature, or null if it does not have a default
      java.util.Map<com.yahoo.searchlib.rankingexpression.Reference,​com.yahoo.tensor.TensorType> featureTypes()  
      void forgetResolvedTypes()  
      com.yahoo.tensor.TensorType getType​(com.yahoo.searchlib.rankingexpression.Reference reference)  
      com.yahoo.tensor.TensorType getType​(java.lang.String reference)  
      java.util.SortedSet<com.yahoo.searchlib.rankingexpression.Reference> queryFeaturesNotDeclared()
      Returns an unmodifiable view of the query features which was requested but for which we have no type info (such that they default to TensorType.empty), shared between all instances of this involved in resolving a particular rank profile.
      void setType​(com.yahoo.searchlib.rankingexpression.Reference reference, com.yahoo.tensor.TensorType type)  
      boolean tensorsAreUsed()
      Returns true if any feature across all instances involved in resolving this rank profile resolves to a tensor
      MapEvaluationTypeContext withBindings​(java.util.Map<java.lang.String,​java.lang.String> bindings)  
      • Methods inherited from class com.yahoo.searchlib.rankingexpression.rule.FunctionReferenceContext

        functions, getBinding, getFunction, withoutBindings
      • Methods inherited from class java.lang.Object

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

      • setType

        public void setType​(com.yahoo.searchlib.rankingexpression.Reference reference,
                            com.yahoo.tensor.TensorType type)
      • getType

        public com.yahoo.tensor.TensorType getType​(java.lang.String reference)
        Specified by:
        getType in interface com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
      • forgetResolvedTypes

        public void forgetResolvedTypes()
      • getType

        public com.yahoo.tensor.TensorType getType​(com.yahoo.searchlib.rankingexpression.Reference reference)
        Specified by:
        getType in interface com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
      • defaultTypeOf

        public com.yahoo.tensor.TensorType defaultTypeOf​(com.yahoo.searchlib.rankingexpression.Reference reference)
        Returns the default type for this simple feature, or null if it does not have a default
      • featureTypes

        public java.util.Map<com.yahoo.searchlib.rankingexpression.Reference,​com.yahoo.tensor.TensorType> featureTypes()
      • queryFeaturesNotDeclared

        public java.util.SortedSet<com.yahoo.searchlib.rankingexpression.Reference> queryFeaturesNotDeclared()
        Returns an unmodifiable view of the query features which was requested but for which we have no type info (such that they default to TensorType.empty), shared between all instances of this involved in resolving a particular rank profile.
      • tensorsAreUsed

        public boolean tensorsAreUsed()
        Returns true if any feature across all instances involved in resolving this rank profile resolves to a tensor
      • withBindings

        public MapEvaluationTypeContext withBindings​(java.util.Map<java.lang.String,​java.lang.String> bindings)
        Overrides:
        withBindings in class com.yahoo.searchlib.rankingexpression.rule.FunctionReferenceContext