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
Modifier and TypeClassDescriptionstatic final class
static final class
static final class
static class
static class
static class
A function in a rank profilestatic class
A rank property.static class
A rank setting.static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
protected Set<RankProfile.RankSetting>
static final String
-
Constructor Summary
ConstructorDescriptionRankProfile
(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 TypeMethodDescriptionvoid
void
add
(RankProfile.Constant constant) void
addAttributeType
(String attributeName, String attributeType) addFunction
(com.yahoo.searchlib.rankingexpression.ExpressionFunction function, boolean inline) Adds a function and returns itvoid
addFunction
(String name, List<String> arguments, String expression, boolean inline) void
addInput
(com.yahoo.searchlib.rankingexpression.Reference reference, RankProfile.Input input) Adds the type of an input feature consumed by this profile.void
addMatchFeatures
(com.yahoo.searchlib.rankingexpression.FeatureList features) Adds the content of the given feature list to the internal list of match features.void
void
addMutateOperation
(RankProfile.MutateOperation.Phase phase, String attribute, String operation) void
addRankFeatures
(com.yahoo.searchlib.rankingexpression.FeatureList features) Adds the content of the given feature list to the internal list of rank features.void
addRankProperty
(String name, String parameter) void
addRankSetting
(RankProfile.RankSetting rankSetting) void
addRankSetting
(String fieldName, RankProfile.RankSetting.Type type, Object value) void
addSummaryFeatures
(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.ApplicationPackage
Returns 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.RankingExpression
Returns the ranking expression to use by this.Returns an unmodifiable snapshot of the functions in thiscom.yahoo.searchlib.rankingexpression.RankingExpression
int
int
Set<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode>
Returns a read-only view of the match features to use in this profile.int
int
int
Set<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.double
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 inheritsint
com.yahoo.searchlib.rankingexpression.RankingExpression
Returns the ranking expression to use by this.Set<com.yahoo.searchlib.rankingexpression.rule.ReferenceNode>
Returns a read-only view of the summary features to use in this profile.void
Adds a profile to those inherited by this.Returns the names of the profiles this inherits, if any.boolean
Returns 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.boolean
isStrict()
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 globalvoid
setApproximateThreshold
(double threshold) void
setFirstPhaseRanking
(String expression) void
setGlobalPhaseRanking
(String expression) void
setGlobalPhaseRerankCount
(int count) void
setIgnoreDefaultRankFeatures
(Boolean ignoreDefaultRankFeatures) Whether we should ignore the default rank features.void
setInheritedMatchFeatures
(String parentProfile) Sets the name of a profile this should inherit the match features of.void
setInheritedSummaryFeatures
(String parentProfile) Sets the name this should inherit the summary features of.void
setKeepRankCount
(int rerankArraySize) void
void
setMinHitsPerThread
(int minHits) void
setNumSearchPartitions
(int numSearchPartitions) void
setNumThreadsPerSearch
(int numThreads) void
setPostFilterThreshold
(double threshold) void
setRankProperty
(String name, String parameter) void
setRankScoreDropLimit
(double rankScoreDropLimit) void
setRerankCount
(int rerankCount) void
setSecondPhaseRanking
(String expression) void
void
setTermwiseLimit
(double termwiseLimit) 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)
-
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
- theRankProfileRegistry
to 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
-
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. -
setMatchPhaseSettings
-
getMatchPhaseSettings
-
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
-
setInheritedSummaryFeatures
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
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) -
getTermwiseLimit
-
getPostFilterThreshold
-
getApproximateThreshold
-
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() -
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. -
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
-