Coveo for Sitecore 5 is now available!

Adding Boosting or Filtering Expressions Using the Coveo for Sitecore Legacy Search UI Framework

Enterprise only Coveo for Sitecore 4.1 - November 2018

This page only applies to Coveo for Sitecore Enterprise users.

To add boosting or filtering rules programmatically, see Using Boosting or Filtering Rules on the Search Component Programmatically or Using Boosting or Filtering Rules on the Tab Component Programmatically.

Using the Rule Set Editor, you can add rules to your search interface to either remove results, or boost them up or down.

Accessing the Rule Set Editor

  1. In Sitecore, access the Experience Editor of your search interface page.
  2. Select the Coveo Search component, and select the Edit properties option. It should be the first icon.

  3. In the Control Properties, scroll to the Result Scope section.
  4. Select Edit rule under Boost expression rules or Filter expression rules to access the Rule Set Editor.

Adding a Boost Expression

Using boosting rules, you can manually change the order of your results. While it is usually used to make certain search results appear first, it can also be used to lower the ranking of certain items.

In this example, you will learn how to boost Mazda car models so they appear first in the search results.

  1. In the Result Scope section of the Control Properties panel, under Boost expression rules, click on Edit Rule.

  2. In the Rule Set Editor, in the left-hand side panel, select the where specific field compares to specific value condition.

    For detailed explanation of each rule, see Rule Set Editor Boosting and Filtering Rules Reference.

  3. Validate that the condition appears under Rule Description.

  4. Click on the specific hyperlink of your newly added condition.
  5. Specify the field by which search results should be boosted up. For this example, this would be the Make field, which identifies the car maker.

    Only the conditions related to Sitecore fields are currently supported.

  6. Click on the compares to hyperlink to change the condition.
  7. Specify the comparison operator that should be used to compare the selected field to the still-to-be-defined value. For this example, choose is equal to.

    In CES, search queries are always case-insensitive. Thus, both the is equal to and the is case-insensitively equal to operators produce the same results. The same applies to is not equal to and is not case-insensitively equal to operators.

    However, results with the same casing as the search query have a higher ranking.

  8. Click on the specific value hyperlink of your condition.
  9. Specify the value that the selected field should compare to. In this example, because you want Mazda models to appear first in search results, you would need to specify Mazda.

  10. Validate that the condition is complete in the Rule Description section.

  11. In the Rule Set Editor, in the right-hand side panel, select the add number to document score action to boost items conforming to your rule.

  12. Validate that the action appeared under Rule Description.

  13. Click on the number hyperlink of your newly added action.
  14. Specify the weight by which search results that correspond to the previous condition should be boosted.

    You should always use a value between 1 and 100. Any value higher than this can lead to unwarranted effects on your ranking.

  15. Validate that the action is complete in the Rule Description section.

  16. Close the Rule Set Editor as well as the Coveo Search properties dialog by clicking on their respective OK buttons.
  17. Save and publish your page.
  18. Validate that Mazda car models appear first in search results.

Adding a Filter Expression

A Filter Expression is used to filter search results by a specific criterion such that only those that satisfy it appear in search results.

In this example, you will filter your search interface so that only Toyota car models appear in the search results.

  1. In the Result Scope section of the Control Properties panel, under Filter expression rules, click on Edit Rule.

  2. In the Rule Set Editor, select the where specific field compares to specific value condition.

    For detailed explanation of each rule, see Rule Set Editor Boosting and Filtering Rules Reference.

  3. Validate that the condition appears under Rule Description.

  4. Click on the specific hyperlink of your newly added condition.
  5. Specify the field by which search results should be filtered, for example the Make field which identifies the car maker.

    Only the conditions related to Sitecore fields are currently supported.

    Only fields configured as facets can be added (see Add or Edit Fields).

  6. Click on the compares to hyperlink to change the condition..
  7. Specify the comparison operator that should be used to compare the selected field to the still-to-be-defined value. For this example, choose is equal to.

    In CES, search queries are always case-insensitive. Thus, both the is equal to and the is case-insensitively equal to operators produce the same results. The same applies to is not equal to and is not case-insensitively equal to operators.

    However, results with the same casing as the search query have a higher ranking.

  8. Click on the specific value hyperlink of your condition.
  9. Specify the value that the selected field should compare to. In this example, because you only want Toyota models to appear in search results, you should specify Toyota.

  10. Validate that the condition is complete in the Rule Description section.

  11. Close the Rule Set Editor as well as the Coveo Search properties dialog by clicking on their respective OK buttons.
  12. Save and publish your page.
  13. Validate that only Toyota car models appear in search results, no matter what query is executed.