Hero product image

The Elasticsearch Hero product image feature enables grouping all SKUs of the product at query time. This topic describes how the Hero product image works. If you want to learn how to set up the Hero product image, refer to Setting up a Hero product image (Product grouping)

Product Id is identified based on the group value of the most relevant SKU to represent the group that is returned in search results to provide visual relevancy.

A common index field is indexed for all underlying SKUs of the product, which is used later as the grouping field. When querying the search index, the collapsing section is added to the Elasticsearch query. As a result, the search response is structured in hits and innerHits, instead of a hit of Search hit. Each group contains hits and innerHits of related documents. The number of rows and pagination is applied to the number of groups, instead of the number of returned search hit documents.

If the Hero product image is enabled and if no searchType value passes through request parameter or in the profile, then searchType value will be defaulted with 5000 (Search expression match type constants - (type:product OR (type:variant AND state:false)). If searchType value passes through request parameter or inside search profile then Hero Product Image will be disabled.

Hero Product Image result selection process

The following diagram demonstrates the sample search group response. Based on the group response, a second call is made to find the group owner:

where:
  • A search query generates six matched Elasticsearch documents, which are grouped into two different groups.
  • Each document returns the most relevant SKU in the top hits.
  • From each group's most relevant SKU the group owner id is found using relationship.product.group field. A second call is made to find the product details.

Hero Product Image processors and search profiles

The SearchRelevancyByProductGroupingPreprocessor is used to read the grouping parameters from a search profile and add them to the search query.

The SearchRelevancyByProductGroupingPostprocessor is added as the first postprocessor to handle the search group response for term search. The postprocessor selects only one Elasticsearch document from each group and makes a second call to find the group owner product and creates search hits to be consumed by other postprocessors. Then, the result is returned in the final REST response.

The HCL_findProductsBySearchTerm search profiles can be used by the productView bySearchTermServices REST service.

The SearchBrowseRelevancyByProductGroupingPostprocessor is added as the first postprocessor to handle the search group response for browsing. The postprocessor selects only one Elasticsearch document from each group and makes a second call to find the group owner product. It creates search hits to be consumed by other postprocessors. Then, the result is returned in the final REST response.

The HCL_findProductsByCategory search profiles can be used by the productView byCategoryId REST service.

Here is a sample group configuration defined in a search profile:
"group": {
	"enable": "false",
	"sort": "score desc",
	"field": "relationship.product.group"
}

Where:

group
enable: true
Grouping is enabled.
enable: false
None of the other groupings are evaluated.
sort: score desc
Controls how the catalog entries are sorted in each group.
field
The field name to group by

Hero Product Image representatives

There is a group representative for each product grouping. Instead of returning the group owner properties, one of the SKUs or some of its properties can be returned along with the group owner. Or, instead of ignoring the other group members, the price range can be found based on the group members.

The following diagram demonstrates the representative product selection process:

Where:
  • The first group contains three group members.
  • One of the SKUs is marked with a merchandising attribute value of Hero. That SKU is selected to be the group representative.
  • A second call is made to Elasticsearch to find the group owner of the representative SKU.
  • After the group owner is fetched, the group representative property is used to override the group owner property.
Here is a sample representative product configuration defined in a search profile:
"hero": {
		"overrideFieldName": "url.thumbnail",
		"showGroupPriceRange": "false", 
              "useMerchandiseAttribute": "false", 
		"field": {
			"7741124012283334335": "Hero"
		}
	}

Where:

hero
overrideFieldName
Takes a list of fields to carry from the SKU to override the productBean default values.
showGroupPriceRange
Is enabled so that the price range for the entire group is displayed, rather than only the product's price, if the group members contain different prices.
useMerchandiseAttribute
Set to true if you are using the merchandise attribute to promote a product SKU. The default false, which will improve performance if you have grouping enabled for browsing but you are not using the merchandise attribute to promote the product SKU.
7741124012283334335
The search attribute id.
Note: The actual attribute id, in this example, represents a merchandising attribute that is assigned as a descriptive attribute to the representative SKUs.