Integrating the Custom Rule Condition in Sitecore Using the Coveo for Sitecore Legacy Search UI Framework

Coveo for Sitecore 4.1 (November 2018)

This page assumes that you have created a custom rule condition and that you made it available in Coveo for Sitecore. To learn how to do so, see Creating a Custom Rule Condition for Coveo for Sitecore.

Now that you have created your custom rule, you need to make it available in Sitecore.

Creating the Condition Item

The first step is to build the C# project and copy the output assembly to the website bin directory, usually located under C:\inetpub\wwwroot\<instance name>\website\bin.

  1. Open the Content Editor and navigate to the item /sitecore/System/Settings/Rules/Definitions/Elements.
  2. Create a new Element folder with a meaningful name for your project. For this example, you can call it MyCustomRules.
  3. In this folder, insert a new Condition item and name it Is Item Part of Current Site. You can find the Condition template under /sitecore/templates/System/Rules/Condition.
  4. In the Text field, write the following value: where the item is part of the current site.
  5. In the Type field, enter the fully qualified class name and the assembly corresponding to the custom rule condition. For this example, use the following: Samples.Rules.IsItemPartOfCurrentSite, Samples.

  6. Save the rule condition.

Make the Rule Available

The next step is to make the rule available in the Rule Set Editor.

  1. Navigate to the item /sitecore/System/Settings/Rules/Definitions/Tags.
  2. Create a new item from the Tag template and name it Custom Rules. You can find the Tag template under /sitecore/templates/System/Rules/Taxonomy/Tag.
  3. Navigate to the item /sitecore/System/Settings/Rules/Definitions/Elements/MyCustomRules/Tags/Default.
  4. In the Tags property in the Taxonomy section, add the Custom Rules tag you just created.
  5. Save the item.
  6. Navigate to the item /sitecore/System/Settings/Rules/Coveo Search Rules/Tags/Default.
  7. In the Tags property in the Taxonomy section, add the Custom Rules tag you just created.

    The Coveo Search Rules item will be overwritten when updating Coveo for Sitecore. If you plan on adding your custom rule in production, you should duplicate the Coveo Search Component and the Coveo Search Rules Item. The final step will be to adjust the Source field on the FilterExpressionRules field of the Coveo Search Base Parameters duplicate.

  8. Save the item.

The rule condition should now be available in the Rule Set Editor on the Coveo Search Component.

What's next for me?