HCL Commerce Version 9.1.12.0 or later

Extending Category searches in Elasticsearch

To enhance relevance of search results, you can use the /configuration REST endpoint to change or extend the level of the category tree that is included in the category search.

Category searching with Elasticsearch

The category search scope is limited to the leaf level category only + noun field. Classification fields mapped to category search are as follows:
CATEGORY=natural.categories.normalized, natural.categories.raw, natural.nouns.raw, natural.nouns.normalized

Changing the scope of the category search

Optionally, to enable the category search enable the category search with a full path of the category, then replace natural.categories.normalized, natural.categories.raw with natural.path_name.normalized

To enable category search, this field can be updated or the previous fields using /configuration endpoint as below with the PATCH or POST request methods.

For example:
PATCH/POST - http://<dataQueryHost>:<dataQueryPort>/search/resources/api/v2/configuration?nodeName=component&envType=auth
Request body:
{
    "extendedconfiguration": {
        "configgrouping": [
            {
                "name": "SearchConfiguration",
                "property": [
                    {
                        "name": "nlp.classification.field.mapping",
                        "value": "NOUN=natural.nouns.normalized#natural.nouns.raw,CATEGORY=natural.path_name.normalized#natural.nouns.raw#natural.nouns.normalized,BRAND_NAME=natural.names.normalized#natural.names.raw,ADJECTIVES=natural.adjectives.normalized#natural.adjectives.raw#natural.nouns.raw#natural.nouns.normalized,ADJECTIVES_NAME=attribute.name.normalized#attribute.name.raw#natural.nouns.raw#natural.nouns.normalized,UNIT_OF_MEASURE_DEFAULT_FIELD=attribute.value.raw#natural.nouns.raw#natural.nouns.normalized,STA_QUERY_FIELD=natural.nouns.normalized#natural.nouns.raw,ROOT_BOOSTING_FIELD=nlp.name.normalized#nlp.keyword.text"
                    }
                ]
            }
        ]
    }
}
Note:
  1. If this is the first time if you are adding the configuration through the /configuration endpoint, then use the POST request method. Otherwise use the PATCH request method.
  2. Before updating the field, ensure that the field natural.path_name.normalized is updated. If the field is not there, do a full reindex to add the field to the product index.
  3. After adding or updating the configuration, restart the Query service.

Enabling category search for non-leaf categories

HCL Commerce allows Shoppers to find products based on their associated parent category name, orin the case of a list of category names. This situation can arise when linked categories or a full category path search are enabled for searching. Once a category name match is found, all products within this category are returned in the search result. Additional refinement can be performed together with other terms in the same search phrase. For example, a search phrase "Gusso dresses" includes a Gusso brand name and a category name (as well as a product name) called "dresses". This search will return all products under those categories that have "dresses" in their name that are of the Gusso brand, followed by other products that only match "Gusso" or "dresses" in their name or short description.

Category search is disabled in Basic NLP. This means that while performing keyword searches, only leaf level categories are considered when matching the input term to categories. You can configure the system to match the input term for non leaf categories as well, using the following configuration endpoint. Set the value of the Ingest property flow.basic.nlp.category.search to true. By default category search is disabled; to enable it, perform the following steps.

  1. Execute a PATCH request to the Ingest configuration API with the included request body.
    PATCH - http://dataQueryHost:dataQueryPort/search/resources/api/v2/configuration?nodeName=ingest&envType=auth
    
    {
    "global": {
    "connector": [
    {
    "name": "attribute",
    "property": [
    { "name": "flow.basic.nlp.category.search", "value": "true" }
                ]
    }
                 ]
              }
    }
  2. Perform a full reindex. See Building the Elasticsearch index for the procedure.
  3. Restart the Query service. For more information, see Starting the Query Docker container with default configurations.