Operators

This is for:

Merchandiser

In the Coveo Merchandising Hub (CMH), operators are essential for filtering products by specific attributes. Common operators can be used along with ranking rules and filter rules, while numerical operators are only available for attributes with numerical values, such as price. Date operators are only available for date attributes, such as a release date, and target products by how recent or upcoming that date is. Operators enable merchandisers to refine product results based on criteria like price, ratings, or other characteristics, enhancing customer experiences and boosting sales through targeted curation.

Common operators

Is

The Is operator identifies products where an attribute exactly matches a specified value.

Example

As a merchandiser, you want to create a filter rule for your listing page that will include all products that belong to the Electronics category. You select the ec_category as an attribute, is as your operator and Electronics as the value.

Is not

The Is not operator identifies products where an attribute doesn’t match a specified value.

Example

As a merchandiser, you want to create a filter rule for your listing page that excludes products in the Electronics category. You select the ec_category as an attribute, is not as your operator and Electronics as the value.

Contains

The Contains operator identifies products where a specific word or phrase is found within the full value of a given attribute.

Example

As a merchandiser, you want to promote all the red products on a listing page for a specific promotional event. To do this, in the Include action, you would select the ec_colors attribute, set the operator as Contains, and enter Red as the value. This rule will then include all products whose ec_colors attribute contains Red, such as crimson red or raspberry red.

Does not contain

The Does not contain operator identifies products where a specified word or phrase isn’t found within the value of a given attribute.

Example

As a merchandiser, you want to create a boost rule based on the ec_name attribute word "wires," however you have a selection of "red wires" that shouldn’t be boosted. You create a second attribute for ec_name that doesn’t contain "red."

Is defined

The Is defined operator identifies whether a value has been assigned to a product attribute.

Example

Your catalog contains products with a base price under the field ec_price and a promotional price under the field ec_promo_price. You want to boost all products that have a promotional price attached to it. To do so, you select the ec_promo_price attribute and then select the Is defined operator, followed by your ranking boost strength. All products with a value defined in the ec_promo_price field will receive a boost in the search results.

Is not defined

The Is not defined operator identifies when a value for a product attribute hasn’t been defined (is empty).

Example

For example, your catalog contains products with a base price under the field ec_price and a promotional price under the field ec_promo_price. You want all full price products to appear higher in the results list. To do so, you select the ec_promo_price attribute and then select the Is not defined operator, followed by your preferred boost amount. All products without a value defined in the ec_promo_price field will receive a boost in the search results.

Numerical operators

Numerical operators enable precise control over numerical product attributes such as price, stock, and ratings. The following explains the role of each operator.

Is greater than (>)

The Is greater than operator identifies product where a numerical attribute is higher than the value entered.

Example

You want to exclude products whose price is more than 100$.

Is less than (<)

The Is less than operator identifies product where a numerical attribute is lower than the value entered.

Example

You want to include products whose price is less than 25$.

Is greater than or equal to (≥)

The Is greater than or equal to operator identifies product where a numerical attribute is higher than, or equal to the value entered.

Example

You want to exclude products whose price is 100$ and above.

Is less than or equal to (≤)

The Is less than or equal to operator identifies product where a numerical attribute is lower than, or equal to the value entered.

Example

You want to include products whose price is 25$ or less.

Date operators

Date operators identify products based on a date attribute, such as the date a product was added to the catalog data or its release date. The time window moves with the current time, so a rule that uses a date operator stays current without edits.

Date operators are only available for fields of the Date type. Date fields don’t offer common or numerical operators. If your date field is indexed with another type, you can’t change its type. Instead, create a new field of the Date type with a different name, map your date metadata to the new field, and then rebuild your Catalog source.

Date operators are available in badge conditions and in ranking and filter rules. They aren’t available for pin rules, spotlight content rules, sponsored product rules, or the conditions that control when a rule applies.

In the last

The In the last operator identifies products whose date attribute falls within a set number of hours or days before the current time.

Example

You want to boost products that were added to your catalog data in the past week. You select the date_added attribute, select In the last as your operator, enter 7, and then select Days.

In the next

The In the next operator identifies products whose date attribute falls within a set number of hours or days after the current time.

Example

You want to badge products that launch in the next 48 hours as "Coming soon." You select the release_date attribute, select In the next as your operator, enter 48, and then select Hours.

In the date range

The In the date range operator identifies products whose date attribute falls within a range of days, either in the past or in the future. Under Timeframe, select one of the following:

  • Days ago: Targets a range in the past. The From value must be greater than the to value. For example, from 30 to 7 days ago.

  • Days from now: Targets a range in the future. The From value must be less than the to value. For example, from 7 to 30 days from now.

Example

You want to boost products that were added to your catalog data between one and two weeks ago, after your newest arrivals. You select the date_added attribute, select In the date range as your operator, select Days ago, and then enter 14 in From and 7 in to.

How date operators evaluate dates

  • The time window counts back or ahead from the exact moment of the query, in UTC. It doesn’t stop at midnight or at the end of a day. For example, In the last 1 day means the last 24 hours, not since midnight. If a rule that uses In the next 2 days applies to a query at 11:00 AM, the window ends 48 hours later, at 11:00 AM. There’s no time zone setting.

  • Date values that you push with a time zone offset are compared as the same moment in UTC, so you don’t need to convert them.

  • Both ends of the window are included. For example, In the date range from 6 to 9 days from now matches dates that are 6 days from now, 9 days from now, and any time between.

  • Numbers must be whole numbers of 1 or greater.

  • In the last and In the next support hours or days. In the date range supports days only.

  • In the last never matches a future date, and In the next never matches a past date.

  • The rule preview uses the same evaluation as live queries. The preview displays date values in your browser’s time zone. To check whether a product matches, compare its date and time to the exact end of the window, not only the day.

  • You can’t combine In the last and In the next in the same rule. A rule targets either past dates or future dates.