Class RankProfile

    • Constructor Detail

      • RankProfile

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

        public RankProfile​(java.lang.String name,
                           VespaModel model,
                           RankProfileRegistry rankProfileRegistry)
        Creates a global rank profile
        Parameters:
        name - the name of the new profile
        model - the model owning this profile
    • Method Detail

      • getName

        public java.lang.String getName()
      • getSearch

        public ImmutableSearch getSearch()
        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
      • setInherited

        public void setInherited​(java.lang.String inheritedName)
        Sets the name of the rank profile this inherits. Both rank profiles must be present in the same search definition
      • getInheritedName

        public java.lang.String getInheritedName()
        Returns the name of the profile this one inherits, or null if none is inherited
      • getInherited

        public RankProfile getInherited()
        Returns the inherited rank profile, or null if there is none
      • inherits

        public boolean inherits​(java.lang.String name)
        Returns whether this profile inherits (directly or indirectly) the given profile
        Parameters:
        name - the profile name to compare this to.
        Returns:
        whether or not this inherits from the named profile.
      • getRankSetting

        public RankProfile.RankSetting getRankSetting​(java.lang.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 java.util.Iterator<RankProfile.RankSetting> declaredRankSettingIterator()
        Returns the rank settings in this rank profile
        Returns:
        an iterator for the declared rank setting
      • rankSettingIterator

        public java.util.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 java.util.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​(java.lang.String name,
                                com.yahoo.searchlib.rankingexpression.evaluation.Value value)
      • addConstantTensor

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

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

        public void addAttributeType​(java.lang.String attributeName,
                                     java.lang.String attributeType)
      • getAttributeTypes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributeTypes()
      • addQueryFeatureType

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

        public java.util.Map<java.lang.String,​java.lang.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​(java.lang.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​(com.yahoo.searchlib.rankingexpression.RankingExpression rankingExpression)
      • setSecondPhaseRanking

        public void setSecondPhaseRanking​(java.lang.String expression)
      • getSummaryFeatures

        public java.util.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
      • 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.
        Parameters:
        features - The features to add.
      • getRankFeatures

        public java.util.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 java.util.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 java.util.Map<java.lang.String,​java.util.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​(java.lang.String name,
                                    java.lang.String parameter)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getRerankCount

        public int getRerankCount()
      • getNumThreadsPerSearch

        public int getNumThreadsPerSearch()
      • setNumThreadsPerSearch

        public void setNumThreadsPerSearch​(int numThreads)
      • getMinHitsPerThread

        public int getMinHitsPerThread()
      • setMinHitsPerThread

        public void setMinHitsPerThread​(int minHits)
      • setNumSearchPartitions

        public void setNumSearchPartitions​(int numSearchPartitions)
      • getNumSearchPartitions

        public int getNumSearchPartitions()
      • getTermwiseLimit

        public java.util.OptionalDouble getTermwiseLimit()
      • setTermwiseLimit

        public void setTermwiseLimit​(double termwiseLimit)
      • setRerankCount

        public void setRerankCount​(int rerankCount)
        Sets the rerank count. Set to -1 to use inherited
      • setIgnoreDefaultRankFeatures

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

        public boolean getIgnoreDefaultRankFeatures()
      • addFunction

        public void addFunction​(java.lang.String name,
                                java.util.List<java.lang.String> arguments,
                                java.lang.String expression,
                                boolean inline)
        Adds a function
      • addFunction

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

        public int getKeepRankCount()
      • setKeepRankCount

        public void setKeepRankCount​(int rerankArraySize)
      • getRankScoreDropLimit

        public double getRankScoreDropLimit()
      • setRankScoreDropLimit

        public void setRankScoreDropLimit​(double rankScoreDropLimit)
      • filterFields

        public java.util.Set<java.lang.String> filterFields()
      • allFilterFields

        public java.util.Set<java.lang.String> allFilterFields()
        Returns all filter fields in this profile and any profile it inherits.
        Returns:
        the set of all filter fields
      • clone

        public RankProfile clone()
        Shallow clones this
        Overrides:
        clone in class java.lang.Object
      • 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,
                                                    java.util.Map<com.yahoo.searchlib.rankingexpression.Reference,​com.yahoo.tensor.TensorType> featureTypes)