Diversity Rules
A customizable Blender rule for ensuring diverse search and ads results
Diversity rules are added to Blender to avoid repeated or similar content and increase the diversity of results shown to the user. This rule addresses many common search problems listed in Troubleshooting Search Diversity.
Promoted implements this rule by analyzing a specified item attribute or feature, and ensures that items with this attribute are not ranked too close together. Here's an example:
DIVERSIFY<COLOR> BY(FEATURE("color_code")) SPACES(3);
This example enforces color diversity by ensuring that items sharing the same color_code
have at least three other items in between them (three "spaces"). In other words, the color is not eligible to repeat until either three items with different colors are allocated, or there are no more eligible candidates.
These are the two main inputs to the rule:
Input | Type | Description |
---|---|---|
feature | string | The content item feature or attribute specified by the client. The intention is for items with this attribute to appear more spaced out in the results. |
spaces | int64 | The minimum number of content items to be allocated between two items with the specified feature. This may be violated if there aren't enough candidates to allocate. |
Diversity rules only impact rules defined after them. In other words, the ordering of content items allocated before the rule is evoked will not be impacted. Multiple diversity rules may be defined, including overlapping ones. The handling of multiple diversity rules is configurable using additional inputs. Contact Promoted for more information.
Rule precedence
// SELECT rules choose a specified number of items for allocation
SELECT<A> WHERE...
// DIVERSITY rules enforce the frequency that items with a specified attribute are repeated
DIVERSIFY<B> BY...
SELECT<C> WHERE...
DIVERSIFY<D> BY...
SELECT<E> WHERE...
Here's how the allocations are ordered, based on this config:
- The allocations performed by A come before diversity rules are declared, and therefore are not impacted.
- The allocations performed by C may be impacted by diversity rule B, as B comes first and may enforce a requirement on items containing a particular attribute. If no items contain that attribute, the allocation will not be impacted by the rule.
- The allocations performed by E may be impacted by B and/or D. Diversity rules can stack.
Diversity is not always guaranteed
If there are few candidates available for allocation, it may not be possible to avoid repeated allocation of similar items. Allowing diversity rules to be violated in edge cases ensures a positive user experience and fewer unexpected results.
Updated about 1 month ago