Integrating the Custom Rule Condition in Sitecore Using the Coveo for Sitecore Legacy Search UI Framework
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’ve 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’ve 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
.
- Open the Content Editor and navigate to the item
/sitecore/System/Settings/Rules/Definitions/Elements
. - Create a new Element folder with a meaningful name for your project. For this example, you can call it
MyCustomRules
. - In this folder, insert a new
Condition
item and name itIs Item Part of Current Site
. You can find theCondition
template under/sitecore/templates/System/Rules/Condition
. - In the Text field, write the following value:
where the item is part of the current site
. -
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
. - Save the rule condition.
Make the Rule Available
The next step is to make the rule available in the Rule Set Editor.
- Navigate to the item
/sitecore/System/Settings/Rules/Definitions/Tags
. - Create a new item from the
Tag
template and name itCustom Rules
. You can find theTag
template under/sitecore/templates/System/Rules/Taxonomy/Tag
. - Navigate to the item
/sitecore/System/Settings/Rules/Definitions/Elements/MyCustomRules/Tags/Default
. - In the Tags property in the Taxonomy section, add the
Custom Rules
tag you just created. - Save the item.
- Navigate to the item
/sitecore/System/Settings/Rules/Coveo Search Rules/Tags/Default
. -
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. - Save the item.
The rule condition should now be available in the Rule Set Editor on the Coveo Search Component.