Class RankProfile

    • Constructor Detail

      • RankProfile

        public RankProfile​(String name,
                           Schema schema,
                           RankProfileRegistry rankProfileRegistry,
                           RankingConstants rankingConstants)
        Creates a new rank profile for a particular search definition
        Parameters:
        name - the name of the new profile
        schema - the search definition owning this profile
        rankProfileRegistry - the RankProfileRegistry to use for storing and looking up rank profiles.
      • RankProfile

        public RankProfile​(String name,
                           com.yahoo.config.application.api.ApplicationPackage applicationPackage,
                           com.yahoo.config.application.api.DeployLogger deployLogger,
                           RankProfileRegistry rankProfileRegistry,
                           RankingConstants rankingConstants,
                           OnnxModels onnxModels)
        Creates a global rank profile
        Parameters:
        name - the name of the new profile
    • Method Detail

      • schema

        public ImmutableSchema schema()
        Returns the search definition owning this, or null if it is global
      • applicationPackage

        public com.yahoo.config.application.api.ApplicationPackage applicationPackage()
        Returns the application this is part of
      • rankingConstants

        public RankingConstants rankingConstants()
        Returns the ranking constants of the owner of this
      • inherit

        public void inherit​(String inheritedName)
        Adds a profile to those inherited by this. The profile must belong to this schema (directly or by inheritance).
      • inheritedNames

        public List<String> inheritedNames()
        Returns the names of the profiles this inherits, if any.
      • inherits

        public boolean inherits​(String name)
        Returns whether this profile inherits (directly or indirectly) the given profile name.
      • getRankSetting

        public RankProfile.RankSetting getRankSetting​(String field,
                                                      RankProfile.RankSetting.Type type)
        Returns a rank setting of field or index, or null if there is no such rank setting in this profile or one it inherits
        Parameters:
        field - the field whose settings to return
        type - the type that the field is required to be
        Returns:
        the rank setting found, or null
      • declaredRankSettingIterator

        public Iterator<RankProfile.RankSetting> declaredRankSettingIterator()
        Returns the rank settings in this rank profile
        Returns:
        an iterator for the declared rank setting
      • rankSettingIterator

        public Iterator<RankProfile.RankSetting> rankSettingIterator()
        Returns all settings in this profile or any profile it inherits
        Returns:
        an iterator for all rank settings of this
      • rankSettings

        public Set<RankProfile.RankSetting> rankSettings()
        Returns a snapshot of the rank settings of this and everything it inherits. Changes to the returned set will not be reflected in this rank profile.
      • addConstant

        public void addConstant​(String name,
                                com.yahoo.searchlib.rankingexpression.evaluation.Value value)
      • addConstantTensor

        public void addConstantTensor​(String name,
                                      com.yahoo.searchlib.rankingexpression.evaluation.TensorValue value)
      • getConstants

        public Map<String,​com.yahoo.searchlib.rankingexpression.evaluation.Value> getConstants()
        Returns an unmodifiable view of the constants available in this
      • addAttributeType

        public void addAttributeType​(String attributeName,
                                     String attributeType)
      • addQueryFeatureType

        public void addQueryFeatureType​(String queryFeature,
                                        String queryFeatureType)
      • getQueryFeatureTypes

        public Map<String,​String> getQueryFeatureTypes()
      • getFirstPhaseRanking

        public com.yahoo.searchlib.rankingexpression.RankingExpression getFirstPhaseRanking()
        Returns the ranking expression to use by this. This expression must not be edited. Returns null if no expression is set.
      • setFirstPhaseRanking

        public void setFirstPhaseRanking​(String expression)
      • getSecondPhaseRanking

        public com.yahoo.searchlib.rankingexpression.RankingExpression getSecondPhaseRanking()
        Returns the ranking expression to use by this. This expression must not be edited. Returns null if no expression is set.
      • setSecondPhaseRanking

        public void setSecondPhaseRanking​(String expression)
      • setInheritedSummaryFeatures

        public void setInheritedSummaryFeatures​(String parentProfile)
        Sets the name this should inherit the summary features of. Without setting this, this will either have the summary features of the single parent setting them, or if summary features are set in this, only have the summary features in this. With this set the resulting summary features of this will be the superset of those defined in this and the final (with inheritance included) summary features of the given parent. The profile must be one which is directly inherited by this.
      • setInheritedMatchFeatures

        public void setInheritedMatchFeatures​(String parentProfile)
        Sets the name of a profile this should inherit the match features of. Without setting this, this will either have the match features of the single parent setting them, or if match features are set in this, only have the match features in this. With this set the resulting match features of this will be the superset of those defined in this and the final (with inheritance included) match features of the given parent. The profile must be one which which is directly inherited by this.
      • getSummaryFeatures

        public Set<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode> getSummaryFeatures()
        Returns a read-only view of the summary features to use in this profile. This is never null
      • getMatchFeatures

        public Set<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode> getMatchFeatures()
        Returns a read-only view of the match features to use in this profile. This is never null
      • addSummaryFeatures

        public void addSummaryFeatures​(com.yahoo.searchlib.rankingexpression.FeatureList features)
        Adds the content of the given feature list to the internal list of summary features.
      • addMatchFeatures

        public void addMatchFeatures​(com.yahoo.searchlib.rankingexpression.FeatureList features)
        Adds the content of the given feature list to the internal list of match features.
      • getRankFeatures

        public Set<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode> getRankFeatures()
        Returns a read-only view of the rank features to use in this profile. This is never null
      • addRankFeatures

        public void addRankFeatures​(com.yahoo.searchlib.rankingexpression.FeatureList features)
        Adds the content of the given feature list to the internal list of rank features.
        Parameters:
        features - The features to add.
      • getRankProperties

        public List<RankProfile.RankProperty> getRankProperties()
        Returns a read only flattened list view of the rank properties to use in this profile. This is never null.
      • getRankPropertyMap

        public Map<String,​List<RankProfile.RankProperty>> getRankPropertyMap()
        Returns a read only map view of the rank properties to use in this profile. This is never null.
      • addRankProperty

        public void addRankProperty​(String name,
                                    String parameter)
      • setRerankCount

        public void setRerankCount​(int rerankCount)
      • getRerankCount

        public int getRerankCount()
      • setNumThreadsPerSearch

        public void setNumThreadsPerSearch​(int numThreads)
      • getNumThreadsPerSearch

        public int getNumThreadsPerSearch()
      • setMinHitsPerThread

        public void setMinHitsPerThread​(int minHits)
      • getMinHitsPerThread

        public int getMinHitsPerThread()
      • setNumSearchPartitions

        public void setNumSearchPartitions​(int numSearchPartitions)
      • getNumSearchPartitions

        public int getNumSearchPartitions()
      • setTermwiseLimit

        public void setTermwiseLimit​(double termwiseLimit)
      • setIgnoreDefaultRankFeatures

        public void setIgnoreDefaultRankFeatures​(Boolean ignoreDefaultRankFeatures)
        Whether we should ignore the default rank features. Set to null to use inherited
      • getIgnoreDefaultRankFeatures

        public boolean getIgnoreDefaultRankFeatures()
      • setKeepRankCount

        public void setKeepRankCount​(int rerankArraySize)
      • getKeepRankCount

        public int getKeepRankCount()
      • setRankScoreDropLimit

        public void setRankScoreDropLimit​(double rankScoreDropLimit)
      • getRankScoreDropLimit

        public double getRankScoreDropLimit()
      • addFunction

        public void addFunction​(String name,
                                List<String> arguments,
                                String expression,
                                boolean inline)
      • addFunction

        public RankProfile.RankingExpressionFunction addFunction​(com.yahoo.searchlib.rankingexpression.ExpressionFunction function,
                                                                 boolean inline)
        Adds a function and returns it
      • addInputFeature

        public void addInputFeature​(String name,
                                    com.yahoo.tensor.TensorType declaredType)
        Use for rank profiles representing a model evaluation; it will assume that a input is provided with the declared type (for the purpose of type resolving).
      • filterFields

        public Set<String> filterFields()
      • allFilterFields

        public Set<String> allFilterFields()
        Returns all filter fields in this profile and any profile it inherits.
      • compile

        public RankProfile compile​(com.yahoo.search.query.profile.QueryProfileRegistry queryProfiles,
                                   ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels importedModels)
        Returns a copy of this where the content is optimized for execution. Compiled profiles should never be modified.
      • typeContext

        public MapEvaluationTypeContext typeContext​(com.yahoo.search.query.profile.QueryProfileRegistry queryProfiles)
        Creates a context containing the type information of all constants, attributes and query profiles referable from this rank profile.
      • typeContext

        public MapEvaluationTypeContext typeContext​(com.yahoo.search.query.profile.QueryProfileRegistry queryProfiles,
                                                    Map<com.yahoo.searchlib.rankingexpression.Reference,​com.yahoo.tensor.TensorType> featureTypes)