HCL Commerce Version 9.1.15.0 or later

Making base catalog fields unsearchable

You can make CATENTDESC.SHORTDESCRIPTION non-searchable by Elasticsearch by modifying the NiFi pipeline.

About this task

The text in base catalog fields can cause irrelevant search results. For example, your catalog entries could have a short description containing text about related products. These entries cause a search match when the product is different from the search terms, but this field would still need to be indexed in order to display on the product detail page.

You can prevent this behavior by setting base catalog fields as unsearchable.

Procedure

  1. Modify the product mappings for the locale en_US, or other applicable locales:
    1. Navigate through the NiFi Flow to the auth.reindex* connector or pipeline, then Product Schema > Product Schema > Setup Elasticsearch Index Schema and the Populate Product index schema processor. Alternatively, use the search bar in the upper right corner of the NiFi canvas, and search for the Populate Product index schema processor in the auth.reindex pipeline.
      Note: *Different steps are needed if you are using the CAS indexing model (auth.reindex.cas). Contact HCL Support for guidance.
    2. Right-click on the Populate Product index schema processor, click Stop, and then click View configuration and the Properties tab. In the Properties tab, click in the Values field for the Index Schema property and copy the Index schema contents into a text editor for editing.
    3. Modify the content as follows. First, search for the description section in the JSON:
      "description": {
      "properties": {
      
      1. Remove "default.search.text", "default.search.split", "default.completion" and "default.suggestion" from the "text" section. The modified section appears as follows:
        "text": {
        "type": "text",
        "analyzer": "custom_analyzer",
        "eager_global_ordinals": "false",
        "index": "true",
        "index_options": "positions",
        "index_phrases": "false",
        "norms": "true",
        "store": "true",
        "copy_to": [
        "default.correction.text",
        ]
        },
        
      2. Copy the modified "text" section and paste it below the "text" section. Rename "text" to "text_en_US" and update the "analyzer" to "custom_en_US_analyzer":
        "text_en_US": {
        "type": "text",
        "analyzer": "custom_en_US_analyzer ",
        "eager_global_ordinals": "false",
        "index": "false",
        "index_options": "positions",
        "index_phrases": "false",
        "norms": "true",
        "store": "true",
        "copy_to": [
        "default.correction.text"
        ]
        }
        
      3. Copy your modified product schema JSON content back into the Values field of the Index Schema property and save the value changes. Then right-click on the Populate Product index schema processor and click Start.
  2. Exclude the description field from NLP indexing. This is required because the description field is copied to natural.nouns and CATENTDESC.SHORTDESCRIPTION would still be searchable if it were present.
    1. Navigate to NiFi Flow > NLP Service. You can use the search bar in the upper right corner to search for the NLP Service process group. When NLP Service appears in the finder, select NLP Service under Process Groups.
    2. Right click on the NLP Service process group and click Stop.
    3. Right click the NLP Service and select Variables.
    4. Locate the index.nlp.description variable and set its value to false.
    5. Right click on the NLP Service process group and select Start.
  3. Perform a full reindex of the auth.reindex connector:
    1. After reindexing, verify the updated schema using the following REST endpoint:
       http://{{es_hostname_port}}/auth.{{storeId}}.product/_mappings/
    2. Test the search REST API using terms that only be be found in short descriptions and confirm the field is not searchable.
  4. Ensure your local changes are persisted to the NiFi Registry. Changes in the NiFi user interface should be saved by versioning the process groups (versioning in the NiFi Registry is scoped to the process group level) where you made your changes.
    1. Return to the Product Schema process group (the parent process group of the Populate Product index schema processor that you changed), and note the asterisk. This indicates there are local changes that are not in sync with the version of the process group in the NiFi Registry.

    2. Right click on the Product Schema process group. Select Version and Commit local changes to persist your local NiFi changes to the NiFi Registry.
    3. Persist the NLP Service variable changes by saving a new version of the process group.
      1. Right-click on the NLP Service process group and click Version > Stop version control.
      2. Right-click again on the NLP Service process group and select Version > Start version control.
      3. Name the flow NLPService_X2 and click Save.
    4. Optionally, build a new version of your NiFi Registry image for your Kubernetes deployment.

What to do next

If you want to move your changes to other environments:

Export your changed process groups (flows) from the NiFi Registry and place them in the /patches directory and they will be picked up by the registry. For more information, see Applying a NiFi flow patch to NiFi Registry, Persisting Ingest changes (NiFi Registry), and CI/CD strategy to deploy customizations

https://help.hcltechsw.com/commerce/9.1.0/search/concepts/C_CICDModel.html