Package com.yahoo.schema
Class RankProfile
java.lang.Object
com.yahoo.schema.RankProfile
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
DefaultRankProfile,DocumentsOnlyRankProfile,UnrankedRankProfile
Represents a rank profile - a named set of ranking settings
- Author:
- bratseth
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic classstatic classstatic final recordstatic classA function in a rank profilestatic classA rank property.static classA rank setting.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected Set<RankProfile.RankSetting>static final String -
Constructor Summary
ConstructorsConstructorDescriptionRankProfile(String name, Schema schema, com.yahoo.config.application.api.ApplicationPackage applicationPackage, com.yahoo.config.application.api.DeployLogger deployLogger, RankProfileRegistry rankProfileRegistry) Creates a global rank profileRankProfile(String name, Schema schema, RankProfileRegistry rankProfileRegistry) Creates a new rank profile for a particular schema -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadd(RankProfile.Constant constant) voidaddAttributeType(String attributeName, String attributeType) voidaddFunction(com.yahoo.searchlib.rankingexpression.ExpressionFunction function, boolean inline) Adds a function and returns itvoidaddFunction(String name, List<String> arguments, String expression, boolean inline) voidaddInheritedMatchFeatures(String parentProfile) Sets the name of a profile this should inherit the match features of.voidaddInheritedSummaryFeatures(String parentProfile) Sets the name this should inherit the summary features of.voidaddInput(com.yahoo.searchlib.rankingexpression.Reference reference, RankProfile.Input input) Adds the type of an input feature consumed by this profile.voidaddMatchFeatures(com.yahoo.searchlib.rankingexpression.FeatureList features) Adds the content of the given feature list to the internal list of match features.voidvoidaddMutateOperation(RankProfile.MutateOperation.Phase phase, String attribute, String operation) voidaddRankFeatures(com.yahoo.searchlib.rankingexpression.FeatureList features) Adds the content of the given feature list to the internal list of rank features.voidaddRankProperty(String name, String parameter) voidaddRankSetting(RankProfile.RankSetting rankSetting) voidaddRankSetting(String fieldName, RankProfile.RankSetting.Type type, Object value) voidaddSummaryFeatures(com.yahoo.searchlib.rankingexpression.FeatureList features) Adds the content of the given feature list to the internal list of summary features.Returns all filter fields in this profile and any profile it inherits.com.yahoo.config.application.api.ApplicationPackageReturns the application this is part ofclone()Shallow clones thiscompile(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.Map<com.yahoo.searchlib.rankingexpression.Reference,RankProfile.Constant> Returns an unmodifiable view of the constants available in thisMap<com.yahoo.searchlib.rankingexpression.Reference,RankProfile.Constant> Returns an unmodifiable view of the constants declared in thisReturns an unmodifiable map of the onnx models declared in this.Returns the rank settings in this rank profileReturns the strict value declared in this or any parent profile.findFunction(String name) com.yahoo.searchlib.rankingexpression.RankingExpressionReturns the ranking expression to use by this.Returns an unmodifiable snapshot of the functions in thiscom.yahoo.searchlib.rankingexpression.RankingExpressiondoubleintSet<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode>intSet<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode>Returns a read-only view of the match features to use in this profile.intintintSet<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode>Returns a read-only view of the rank features to use in this profile.Returns a read only flattened list view of the rank properties to use in this profile.Returns a read only map view of the rank properties to use in this profile.doublegetRankSetting(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 inheritsintcom.yahoo.searchlib.rankingexpression.RankingExpressionReturns the ranking expression to use by this.doubleSet<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode>Returns a read-only view of the summary features to use in this profile.voidAdds a profile to those inherited by this.Returns the names of the profiles this inherits, if any.booleanReturns whether this profile inherits (directly or indirectly) the given profile name.Map<com.yahoo.searchlib.rankingexpression.Reference,RankProfile.Input> inputs()Returns the inputs of this, which also includes all inputs of the parents of this.booleanisStrict()Returns whether type checking should fail if this profile accesses query features that are not defined in query profile types.name()Returns an unmodifiable map of the onnx models available in this.Returns all settings in this profile or any profile it inheritsReturns a snapshot of the rank settings of this and everything it inherits.schema()Returns the search definition owning this, or null if it is globalvoidsetApproximateThreshold(double threshold) voidvoidsetExplicitFieldRankElementGaps(Map<String, ElementGap> fieldElementGaps) voidsetExplicitFieldRankFilterThresholds(Map<String, Double> fieldFilterThresholds) voidsetExplorationSlack(double slack) voidsetFilterFirstExploration(double exploration) voidsetFilterFirstThreshold(double threshold) voidsetFilterThreshold(double threshold) voidsetFirstPhaseRanking(String expression) voidsetGlobalPhaseRanking(String expression) voidsetGlobalPhaseRankScoreDropLimit(double limit) voidsetGlobalPhaseRerankCount(int count) voidsetIgnoreDefaultRankFeatures(Boolean ignoreDefaultRankFeatures) Whether we should ignore the default rank features.voidsetKeepRankCount(int rerankArraySize) voidsetMatchPhase(RankProfile.MatchPhaseSettings settings) voidsetMinHitsPerThread(int minHits) voidsetNumSearchPartitions(int numSearchPartitions) voidsetNumThreadsPerSearch(int numThreads) voidsetPostFilterThreshold(double threshold) voidsetRankProperty(String name, String parameter) voidsetRankScoreDropLimit(double rankScoreDropLimit) voidsetRerankCount(int rerankCount) voidsetSecondPhaseRanking(String expression) voidsetSecondPhaseRankScoreDropLimit(double limit) voidvoidsetTargetHitsMaxAdjustmentFactor(double factor) voidsetTermwiseLimit(double termwiseLimit) voidsetUseSignificanceModel(Boolean useSignificanceModel) voidsetWeakandAdjustTarget(double target) voidsetWeakandAllowDropAll(boolean value) voidsetWeakandStopwordLimit(double limit) toString()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(com.yahoo.search.query.profile.QueryProfileRegistry queryProfiles, Map<com.yahoo.searchlib.rankingexpression.Reference, com.yahoo.tensor.TensorType> featureTypes) boolean
-
Field Details
-
FIRST_PHASE
- See Also:
-
SECOND_PHASE
- See Also:
-
GLOBAL_PHASE
- See Also:
-
rankSettings
-
-
Constructor Details
-
RankProfile
Creates a new rank profile for a particular schema- Parameters:
name- the name of the new profileschema- the schema owning this profilerankProfileRegistry- theRankProfileRegistryto use for storing and looking up rank profiles.
-
RankProfile
public RankProfile(String name, Schema schema, com.yahoo.config.application.api.ApplicationPackage applicationPackage, com.yahoo.config.application.api.DeployLogger deployLogger, RankProfileRegistry rankProfileRegistry) Creates a global rank profile- Parameters:
name- the name of the new profile
-
-
Method Details
-
name
-
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 -
isStrict
public boolean isStrict()Returns whether type checking should fail if this profile accesses query features that are not defined in query profile types. Default is false. -
declaredStrict
Returns the strict value declared in this or any parent profile. -
setStrict
-
setUseSignificanceModel
-
useSignificanceModel
public boolean useSignificanceModel() -
inherit
Adds a profile to those inherited by this. The profile must belong to this schema (directly or by inheritance). -
inheritedNames
Returns the names of the profiles this inherits, if any. -
inherits
Returns whether this profile inherits (directly or indirectly) the given profile name. -
setMatchPhase
-
getMatchPhase
-
setDiversity
-
getDiversity
-
addRankSetting
-
addRankSetting
-
getRankSetting
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 returntype- the type that the field is required to be- Returns:
- the rank setting found, or null
-
declaredRankSettingIterator
Returns the rank settings in this rank profile- Returns:
- an iterator for the declared rank setting
-
rankSettingIterator
Returns all settings in this profile or any profile it inherits- Returns:
- an iterator for all rank settings of this
-
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. -
add
-
declaredConstants
public Map<com.yahoo.searchlib.rankingexpression.Reference,RankProfile.Constant> declaredConstants()Returns an unmodifiable view of the constants declared in this -
constants
Returns an unmodifiable view of the constants available in this -
add
-
declaredOnnxModels
Returns an unmodifiable map of the onnx models declared in this. -
onnxModels
Returns an unmodifiable map of the onnx models available in this. -
addAttributeType
-
getAttributeTypes
-
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. -
getFirstPhase
-
setFirstPhaseRanking
-
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. -
getSecondPhase
-
setSecondPhaseRanking
-
getGlobalPhaseRanking
public com.yahoo.searchlib.rankingexpression.RankingExpression getGlobalPhaseRanking() -
getGlobalPhase
-
setGlobalPhaseRanking
-
addInheritedSummaryFeatures
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. -
addInheritedMatchFeatures
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
Returns a read-only view of the summary features to use in this profile. This is never null -
getMatchFeatures
Returns a read-only view of the match features to use in this profile. This is never null -
getHiddenMatchFeatures
-
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
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
Returns a read only flattened list view of the rank properties to use in this profile. This is never null. -
getRankPropertyMap
Returns a read only map view of the rank properties to use in this profile. This is never null. -
addRankProperty
-
setRankProperty
-
setRerankCount
public void setRerankCount(int rerankCount) -
getRerankCount
public int getRerankCount() -
setGlobalPhaseRerankCount
public void setGlobalPhaseRerankCount(int count) -
getGlobalPhaseRerankCount
public int getGlobalPhaseRerankCount() -
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) -
setPostFilterThreshold
public void setPostFilterThreshold(double threshold) -
setApproximateThreshold
public void setApproximateThreshold(double threshold) -
setFilterFirstThreshold
public void setFilterFirstThreshold(double threshold) -
setFilterFirstExploration
public void setFilterFirstExploration(double exploration) -
setExplorationSlack
public void setExplorationSlack(double slack) -
setTargetHitsMaxAdjustmentFactor
public void setTargetHitsMaxAdjustmentFactor(double factor) -
setWeakandStopwordLimit
public void setWeakandStopwordLimit(double limit) -
setWeakandAdjustTarget
public void setWeakandAdjustTarget(double target) -
setWeakandAllowDropAll
public void setWeakandAllowDropAll(boolean value) -
setFilterThreshold
public void setFilterThreshold(double threshold) -
getTermwiseLimit
-
getPostFilterThreshold
-
getApproximateThreshold
-
getFilterFirstThreshold
-
getFilterFirstExploration
-
getExplorationSlack
-
getTargetHitsMaxAdjustmentFactor
-
getWeakandStopwordLimit
-
getWeakandAllowDropAll
-
getWeakandAdjustTarget
-
getFilterThreshold
-
setIgnoreDefaultRankFeatures
Whether we should ignore the default rank features. Set to null to use inherited -
getIgnoreDefaultRankFeatures
-
setKeepRankCount
public void setKeepRankCount(int rerankArraySize) -
getKeepRankCount
public int getKeepRankCount() -
setRankScoreDropLimit
public void setRankScoreDropLimit(double rankScoreDropLimit) -
getRankScoreDropLimit
public double getRankScoreDropLimit() -
setSecondPhaseRankScoreDropLimit
public void setSecondPhaseRankScoreDropLimit(double limit) -
getSecondPhaseRankScoreDropLimit
public double getSecondPhaseRankScoreDropLimit() -
setGlobalPhaseRankScoreDropLimit
public void setGlobalPhaseRankScoreDropLimit(double limit) -
getGlobalPhaseRankScoreDropLimit
public double getGlobalPhaseRankScoreDropLimit() -
addFunction
-
addFunction
public RankProfile.RankingExpressionFunction addFunction(com.yahoo.searchlib.rankingexpression.ExpressionFunction function, boolean inline) Adds a function and returns it -
addInput
public void addInput(com.yahoo.searchlib.rankingexpression.Reference reference, RankProfile.Input input) Adds the type of an input feature consumed by this profile. All inputs must either be declared through this or in query profile types, otherwise they are assumes to be scalars. -
inputs
Returns the inputs of this, which also includes all inputs of the parents of this. -
addMutateOperation
-
addMutateOperation
public void addMutateOperation(RankProfile.MutateOperation.Phase phase, String attribute, String operation) -
getMutateOperations
-
findFunction
-
getFunctions
Returns an unmodifiable snapshot of the functions in this -
filterFields
-
allFilterFields
Returns all filter fields in this profile and any profile it inherits. -
setExplicitFieldRankFilterThresholds
-
explicitFieldRankFilterThresholds
-
setExplicitFieldRankElementGaps
-
explicitFieldRankElementGaps
-
clone
Shallow clones this -
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
-
typeContext
public MapEvaluationTypeContext typeContext(com.yahoo.search.query.profile.QueryProfileRegistry queryProfiles, Map<com.yahoo.searchlib.rankingexpression.Reference, com.yahoo.tensor.TensorType> featureTypes) -
toString
-
getFeatureNormalizers
-
addFeatureNormalizer
-