HCL Commerce Version 9.1.7.0 or later

Understanding search term processing logic in the Query service

This topic describes how the Query service processes search terms that use confusing or incorrect words.

Shoppers are not experts in formulating the search query that can yield the desired search results to them. They are often unaware of the ideal search terms to use to find products or services at the storefront. Using Natural Language Processing, the Query service is able to understand plain-language search terms and discern what shoppers are trying to find. It modifies the search term at runtime to fetch the desired search results to the shoppers. The search term processing logic of the Query service is described with the help of the following examples. Each example consists of an example search term and the search term processing logic that the Query service uses to process the search term and fetch the desired search results at the storefront.

For more information about how the service works, see Natural Language Processing (NLP) in Version 9.1.

Examples

Search term Search term processing logic
white shirt girls NLP parser generates the following three tokens to map the search term and then runs the Elasticsearch query to fetch the search results at the storefront. It returns two products.
  • white – COLOR
  • shirt – CATEGORY
  • girls – CATEGORY
white shirt girls under 37$ NLP parser generates the following four tokens to map the search term and then runs the Elasticsearch query to fetch the search results at the storefront. It returns a single product.
  • white – COLOR
  • shirt – CATEGORY
  • girls – CATEGORY
  • under 37$ - FILTER
white shirt girls under 20$ NLP parser generates the following four tokens to map the search term and then runs the Elasticsearch query to fetch the search results at the storefront. It returns zero matches.
  • white – COLOR
  • shirt – CATEGORY
  • girls – CATEGORY
  • under 20$ - FILTER
In this case, the NLP parser uses search term dropping logic. It starts to drop the search phrase from left with one token at a time until it gets the tokens to fetch the appropriate search results or up to four iterations. If there is any price filter in the search phrase/term, then it also gets removed in this process. Post completion of search dropping logic, the NLP parser runs the Elasticsearch query based on the following two tokens. It returns all the eight products from the girls’ category by considering the shirt as a category or in the name or the short description of the product.
  • shirt – CATEGORY
  • girls – CATEGORY
vitamin capsules NLP parser generates the following two tokens to map the search term and then runs the Elasticsearch query to fetch the search results. It returns zero matches because capsule has been set as an attribute value and based on the aforementioned tokens the Elasticsearch query searches capsules against the Noun field.
  • vitamin – CATEGORY
  • capsules – NOUN
In this case, the NLP parser uses search term dropping logic. But this also returns the empty search results because capsule has been set as an attribute value and the Elasticsearch query searches capsules against the Noun field. To handle such situations there is a business logic in place which runs the fallback Elasticsearch query based on the previous analysis of the search phrase/term. The Elasitcsearch query gets executed based on the following token. This returns all the products with the vitamin category.
  • vitamin – CATEGORY
Note: Lemmatization is applied only to BRAND values, while Stemming is used with NOUN, CATEGORY, and ATTRIBUTE values.