Class RelevancyRule
java.lang.Object
com.broadleafcommerce.search.api.domain.RelevancyRule
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware,Serializable
public class RelevancyRule
extends Object
implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware
This represents a rule that can be configured to increase the relevancy of a document. This can
be applied to any document field that is searchable.
- Since:
- Search Service 2.2.0, Release Train 2.2.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanDefines the ending time for which this relevancy rule is active.Defines the beginning time for which this relevancy rule is active.Miscellaneous attributes for this relevancy rule.getBoost()The amount to boost documents that match this relevancy rule.The rule required to be met for this relevancy rule to be active.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStateA subset ofTrackinginformation to expose the context state for this object.getField()TheFieldRefthis relevancy rule belongs to.getId()The context ID of the relevancy rule.The text to match against when using aDefaultRelevancyRuleTypes.MATCHING_VALUErule type.This field can be set to provide the lower limit for a boost function score.getName()The friendly name to identify this relevancy rule.The type of rule that is setup to apply relevancy boosts.The search term required to match for this relevancy rule to be active.The field variant type that should be boosted for this rule.inthashCode()booleanbooleanWhether or not to apply a small boost for a higher frequency of matching values within the field.booleanWhether or not the relevancy rule boosts results by the highest or lowest value.booleanbooleanWhether or not to evaluate the match against thegetSearchTermMatch()with regex enabled.voidsetActiveEndDate(Instant activeEndDate) Defines the ending time for which this relevancy rule is active.voidsetActiveStartDate(Instant activeStartDate) Defines the beginning time for which this relevancy rule is active.voidsetApplyMatchingValueFrequencyBoost(boolean applyMatchingValueFrequencyBoost) Whether or not to apply a small boost for a higher frequency of matching values within the field.voidsetAttributes(Map<String, Object> attributes) Miscellaneous attributes for this relevancy rule.voidThe amount to boost documents that match this relevancy rule.voidsetBoostRule(String boostRule) The rule required to be met for this relevancy rule to be active.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidsetDescending(boolean descending) Whether or not the relevancy rule boosts results by the highest or lowest value.voidTheFieldRefthis relevancy rule belongs to.voidThe context ID of the relevancy rule.voidsetMatchingValue(String matchingValue) The text to match against when using aDefaultRelevancyRuleTypes.MATCHING_VALUErule type.voidsetMinimumScore(Double minimumScore) This field can be set to provide the lower limit for a boost function score.voidThe friendly name to identify this relevancy rule.voidsetRuleType(String ruleType) The type of rule that is setup to apply relevancy boosts.voidsetSearchTermMatch(String searchTermMatch) The search term required to match for this relevancy rule to be active.voidsetSearchTermRegex(boolean searchTermRegex) Whether or not to evaluate the match against thegetSearchTermMatch()with regex enabled.voidsetVariantType(String variantType) The field variant type that should be boosted for this rule.toString()
-
Constructor Details
-
RelevancyRule
public RelevancyRule()
-
-
Method Details
-
isRuledRelevancyRule
public boolean isRuledRelevancyRule() -
hasSearchTermMatch
public boolean hasSearchTermMatch() -
getFieldDefinitionId
-
getFieldIndexableType
-
getId
The context ID of the relevancy rule.- Returns:
- the context ID of the relevancy rule
-
getField
TheFieldRefthis relevancy rule belongs to. Onlyid,indexableType, andlabelare serialized in API responses.- Returns:
- field to be sorted on
-
getName
The friendly name to identify this relevancy rule.- Returns:
- friendly name to identify this relevancy rule
-
getVariantType
The field variant type that should be boosted for this rule.- Returns:
- the variant type that should be boosted for this rule
-
getActiveStartDate
Defines the beginning time for which this relevancy rule is active. If both the active start date and theactive end dateare null, this relevancy rule is considered to always be active.- Returns:
- the beginning time for which this relevancy rule is active
- See Also:
-
getActiveEndDate
Defines the ending time for which this relevancy rule is active. If theactive start dateis not null, but the active end date is, the relevancy rule is considered to be active forever, starting on the start date.- Returns:
- the ending time for which this relevancy rule is active
- See Also:
-
getRuleType
The type of rule that is setup to apply relevancy boosts. SeeDefaultRelevancyRuleTypesfor all available types.- Returns:
- the type of rule that is setup to apply relevancy boosts
-
getBoost
The amount to boost documents that match this relevancy rule.- Returns:
- the amount to boost documents that match this relevancy rule
-
getBoostRule
The rule required to be met for this relevancy rule to be active. This is by default a SpEL expression, but may be any expression language.- Returns:
- The rule.
- See Also:
-
getMinimumScore
This field can be set to provide the lower limit for a boost function score. Only used for ordinal & relative rule types.- Returns:
- provides the lower limit for a boost function score
-
isDescending
public boolean isDescending()Whether or not the relevancy rule boosts results by the highest or lowest value. This field is only used for ordinal & relative rule types. By default, assumption is an descending sort.- Returns:
- whether or not the relevancy rule boosts results by the highest or lowest value
-
getMatchingValue
The text to match against when using aDefaultRelevancyRuleTypes.MATCHING_VALUErule type. Boosts any documents whose field contains this value.- Returns:
- the text to match against when using a
DefaultRelevancyRuleTypes.MATCHING_VALUErule type
-
isApplyMatchingValueFrequencyBoost
public boolean isApplyMatchingValueFrequencyBoost()Whether or not to apply a small boost for a higher frequency of matching values within the field.- Returns:
- whether or not to apply a small boost for a higher frequency of matching values within the field
-
isSearchTermRegex
public boolean isSearchTermRegex()Whether or not to evaluate the match against thegetSearchTermMatch()with regex enabled.- Returns:
- whether or not to evaluate the match against the
getSearchTermMatch()with regex enabled
-
getSearchTermMatch
The search term required to match for this relevancy rule to be active. IfisSearchTermRegex()istrue, then this search term will be evaluated as a regex expression. If left empty, will assume that every search term matches.- Returns:
- the search term required to match for this relevancy rule to be active
-
getAttributes
Miscellaneous attributes for this relevancy rule.- Returns:
- Miscellaneous attributes for this relevancy rule.
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object
-
setId
The context ID of the relevancy rule.- Parameters:
id- the context ID of the relevancy rule
-
setField
TheFieldRefthis relevancy rule belongs to. Onlyid,indexableType, andlabelare serialized in API responses.- Parameters:
field- field to be sorted on
-
setName
The friendly name to identify this relevancy rule.- Parameters:
name- friendly to identify this relevancy rule
-
setVariantType
The field variant type that should be boosted for this rule.- Parameters:
variantType- the variant type that should be boosted for this rule
-
setActiveStartDate
Defines the beginning time for which this relevancy rule is active. If both the active start date and theactive end dateare null, this relevancy rule is considered to always be active.- Parameters:
activeStartDate- the beginning time for which this relevancy rule is active- See Also:
-
setActiveEndDate
Defines the ending time for which this relevancy rule is active. If theactive start dateis not null, but the active end date is, the relevancy rule is considered to be active forever, starting on the start date.- Parameters:
activeEndDate- the ending time for which this relevancy rule is active- See Also:
-
setRuleType
The type of rule that is setup to apply relevancy boosts. SeeDefaultRelevancyRuleTypesfor all available types.- Parameters:
ruleType- the type of rule that is setup to apply relevancy boosts
-
setBoost
The amount to boost documents that match this relevancy rule.- Parameters:
boost- the amount to boost documents that match this relevancy rule
-
setBoostRule
The rule required to be met for this relevancy rule to be active. This is by default a SpEL expression, but may be any expression language.- Parameters:
boostRule- The rule to evaluate.- See Also:
-
setMinimumScore
This field can be set to provide the lower limit for a boost function score. Only used for ordinal & relative rule types.- Parameters:
minimumScore- provides the lower limit for a boost function score
-
setDescending
public void setDescending(boolean descending) Whether or not the relevancy rule boosts results by the highest or lowest value. This field is only used for ordinal & relative rule types. By default, assumption is an descending sort.- Parameters:
descending- whether or not the relevancy rule boosts results by the highest or lowest value
-
setMatchingValue
The text to match against when using aDefaultRelevancyRuleTypes.MATCHING_VALUErule type. Boosts any documents whose field contains this value.- Parameters:
matchingValue- the text to match against when using aDefaultRelevancyRuleTypes.MATCHING_VALUErule type
-
setApplyMatchingValueFrequencyBoost
public void setApplyMatchingValueFrequencyBoost(boolean applyMatchingValueFrequencyBoost) Whether or not to apply a small boost for a higher frequency of matching values within the field.- Parameters:
applyMatchingValueFrequencyBoost- whether or not to apply a small boost for a higher frequency of matching values within the field
-
setSearchTermRegex
public void setSearchTermRegex(boolean searchTermRegex) Whether or not to evaluate the match against thegetSearchTermMatch()with regex enabled.- Parameters:
searchTermRegex- whether or not to evaluate the match against thegetSearchTermMatch()with regex enabled
-
setSearchTermMatch
The search term required to match for this relevancy rule to be active. IfisSearchTermRegex()istrue, then this search term will be evaluated as a regex expression. If left empty, will assume that every search term matches.- Parameters:
searchTermMatch- the search term required to match for this relevancy rule to be active
-
setAttributes
Miscellaneous attributes for this relevancy rule.- Parameters:
attributes- Miscellaneous attributes for this relevancy rule.
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-