Enabling rule-based sales categories

You can enable rule-based sales categories so that business users can apply the rules for rule-based sales categories in the Catalogs tool. When you are enabling rule-based sales categories, you can also configure properties to control how to automatically reapply the rules for rule-based sales categories.

For more information about administering rule-based sales categories, see Rule-based sales category overview.

By default, business users can create, change, and delete rule-based sales categories and define the rules for the categories, but they cannot apply the rules. Before a business user can apply the rule for finding and assigning catalog entries, you must enable the evaluation and application of rule-based sales category rules.

When you are updating your custom catalog component configuration file, you can also configure the values that control automatically reapplying the rule for each category.


  1. Go to the following directory and open your custom wc-admin-component.xml catalog component configuration file for editing:
    • workspace_dir\WC\xml\config\com.ibm.commerce.catalog-ext
    Note: If the custom com.ibm.commerce.catalog-ext directory and wc-admin-component.xml file does not exist for your site, you must create the directory and file.
  2. Go to the following directory and open the default wc-admin-component.xml catalog features component configuration file:
    • workspace_dir\WC\xml\config\com.ibm.commerce.catalog
    The wc-admin-component.xml file in this directory includes configuration properties that you set to change the behavior of catalog-related features. The RuleBasedCategoryConfiguration configuration grouping in this file includes the configurable properties that are specific to rule-based sales categories.
  3. Copy the following RuleBasedCategoryConfiguration configuration grouping from the default wc-admin-component.xml configuration file into the corresponding location in your custom wc-admin-component.xml configuration file.
    <_config:configgrouping name="RuleBasedCategoryConfiguration">
      <_config:property name="evaluationEnabled" value="false" />
      <_config:property name="evaluationHostname" value="" />	
      <_config:property name="evaluationTimeInterval" value="-1" />
    The comments in the file are omitted for readability.
  4. In your custom wc-admin-component.xml configuration file, enable the evaluationEnabled configurable property by setting the value for the property to "true".
    This property indicates whether the rules for rule-based categories can be applied to the categories. This setting applies for all rule-based sales categories in the system. When the rule is applied to a category, HCL Commerce search uses the rule to find catalog entries that match the search filters in the rule. The catalog services then assign the catalog entries to the category. The resulting relationships between the catalog entries and the category are stored in the CATGPENREL database table.

    When this property is enabled, a check is performed to determine whether the EvaluateRuleBasedCategories job is being run in a production environment. If the environment that you are running the EvaluateRuleBasedCategories job within does not have workspaces or a configured staging environment, the evaluationEnabled property is disabled. This check ensures that the rule does not get reapplied in the production environment. If rules need to be defined for assigning catalog entries that exist only in a production environment, copy the data from the product environment to the authoring environment. By applying the rules for a category in an authoring environment, the application of the rule can be tested and approved before the category is propagated to production.

    Note: You can reset the enablement configuration setting and other rule-based sales category configuration settings by changing the values for the properties and refreshing the RuleBasedCategoryConfiguration registry in the Administration Console.
    If your custom wc-admin-component.xml file includes only the RuleBasedCategoryConfiguration grouping, the contents of your file can look like the following file:
      xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-admin-component.xsd">
        <_config:configgrouping name="RuleBasedCategoryConfiguration">
          <_config:property name="evaluationEnabled" value="true" />
          <_config:property name="evaluationHostname" value="" />	
          <_config:property name="evaluationTimeInterval" value="-1" />
  5. Optional: Configure the properties that control the use of a EvaluateRuleBasedCategories job for automatically reapplying rule-based sales category rules. By configuring these properties, the rule evaluation and application job can run automatically after a configured amount of time elapses from the last time that the rule was evaluated.
    1. In your custom wc-admin-component.xml configuration file, set a value for the evaluationHostname configurable property.
      This property ensures that the EvaluateRuleBasedCategories job runs on only a single node. Consider setting a value for this property to isolate the process for finding and assigning catalog entries to rule-based sales categories from other processes.

      Set the value for this evaluationHostname property to be the hostname for the server that you want the EvaluateRuleBasedCategories job to run on.

    2. Set a value for the evaluationTimeInterval configurable property to be a positive value.
      This value is the time interval in seconds that elapses before the job runs to reapply the rule for a category. The default value for this property is "-1", which indicates that the evaluation job is to never run.

      When the time interval elapses, the EvaluateRuleBasedCategories job runs to reapply the rule to a category. This interval is measured independently for each rule-based category from the time that the rule was last applied.

      Note: If you set a value that causes rules to be reapplied frequently, multiple evaluation jobs are added to the scheduler, which can affect performance. If you configure the evaluation job to run infrequently, business users that are working with the category in Management Center might not be working with most current catalog entries that belong in the category. Business users must then manually reapply the rule to work with an up-to-date category.

      This time interval is ignored when the value in the CATGRPRULE.EVALUATING column for a category is set to "2". This column value indicates that the job to reapply the rule can be run regardless of the time interval. For example, when the buildindex REST API is called as part of a staging propagation process. When the search indexing completes, the column value for any updated categories is set to "2" and an event listener is triggered. The event listener calls the RuleBasedCategoryHelper utility class to begin the process to reapply the rule for the categories.

  6. Save and close the file.
  7. Optional: Configure the maximum number of catalog entries that can be returned by HCL Commerce Search to be assigned to a rule-based sales category.
    The value for this property sets an upper limit for the number of catalog entries that can be assigned in case a business user does not set a maximum value in the Catalogs tool for a category, or sets the value too high. The count for this limit is based on the products, bundles, kits, and category-level SKUs that match the search filter conditions and are specified by a business user.
    1. Go to the following directory and open your custom wc-search.xml search configuration file for editing:
      • workspace_dir\WC\xml\config\com.ibm.commerce.catalog-ext
      Note: If the custom wc-search.xml file does not exist for your site, you must create the directory and file. For more information, see Changing properties in the search configuration file (wc-search.xml) (WC EAR).
    2. Go to the following directory and open the default wc-search.xml search configuration file:
      • workspace_dir\WC\xml\config\com.ibm.commerce.catalog
    3. Search for the following configuration profile:
      <_config:profile indexName="CatalogEntry" name="IBM_salesCatalogDynamicCatalogEntryRecommendation">
          <_config:param name="maxRows" value="500"/>
          <_config:param name="maxTimeAllowed" value="15000"/>
          <_config:field name="catentry_id"/>
    4. Copy the "maxRows" configurable property from the default wc-search.xml file to the corresponding location in your custom file.
    5. Change the value of the "maxRows" configurable property to set the maximum number of catalog entries that can be assigned to a category.
    6. Save and close the file.
    If the elastic search is enabled, change the value for "maxRows" in the HCL_salesCatalogDynamicCatalogEntryRecommendation search profile. TheHCL_salesCatalogDynamicCatalogEntryRecommendation profile can be accessed through the profiles endpoint on the data query service.
    GET - http://<dataQueryHost>:<dataQueryPort>/search/resources/api/v2/documents/profiles/HCL_salesCatalogDynamicCatalogEntryRecommendation

    The above request will return the profile in JSON format. To override the same profile, modify the "maxRows" value.

    The profile is created using the PUT request method of the profile's endpoint by sending the request body in JSON format.
    Note: A restart of the query service is required.
  8. Test your configuration changes.