Setting up your custom search profile

ZooKeeper stores the named profiles in one of its nodes. You can create, update, delete the profiles, and get them using the profiles endpoint of the Query service. For more information about HCL Commerce Search profiles, see Search profiles.

Endpoint and profile document specification

The endpoint for the profile is:
https://data_environment_hostname:30921/search/resources/api/v2/documents/profiles/profileName
For the full REST API specification, see the Query REST API.
Each profile document is in .json format and has the following structure. (This example shows the Elasticsearch Highlighting feature; for more information about this feature, see Highlighting in the Elasticsearch Guide.)
{
	"indexName": "string",
	"parentProfileName": "string",
	"profileName": "string",
	"query": {
		"highlight": {
			"fields": [
				"name",
				"fieldName"
			],
			"simplePre": "<strong><span class=font2>",
			"simplePost": "</span></strong>"
		},
		"params": [
			{
				"paramName": "value"
			}
		],
		"postprocessor": [
			"postprocessorClass"
		],
		"preprocessor": [
			"preprocessorClass"
		],
		"provider": [
			"providerClass"
		],
		"queryFields": [
			"field1",
			"filed2"
		],
		"responseFields": [
			"field1",
			"filed2"
		],
		"sortFields": {
			"key": "value"
		},
		"spellcheck": {
			"limit": "5"
		},
		"group" : {
			"enable" : "false",
			"sort" : "score desc",
			"field" : "relationship.product.group"
		},
		"hero" : {
			"overrideFieldName" : "url.thumbnail",
			"showGroupPriceRange" : "false",
			"field" : {
				"7741124012283334335" : "Hero"
			}
		}
	}
}

For a description of the field names and values, and the available pre- and post-processors, see Search profile properties.

HCL Commerce Version 9.1.13.0 or later

Lookup profiles

You can use a Lookup profile if the Hero Product Image is enabled. When the term search API has grouping enabled, it uses the Lookup profile to get the group owner (parent product) details. The term search API uses the HCL_findProductsBySearchTerm profile, which has a Lookup profile property with value HCL_findCatalogEntryById. You define the Lookup profile as follows:
{
      "parentProfileName" : "",
      "profileName" : "HCL_findProductsBySearchTerm",
      "lookupProfileName" : "HCL_findCatalogEntryById",
      "indexName" : "product",
      "query" : {
Internally the SearchRelevancyByProductGroupingPostprocessor processor uses the Lookup profile to fetch the product details. Similarly, if a Hero Product Images is enabled for category browsing then the HCL_findProductsByCategory profile has the Lookup profile property with value HCL_findCatalogEntryByIdForBrowse. Internally, the SearchBrowseRelevancyByProductGroupingPostprocessor processor uses the Lookup profile to fetch the product details.
{
      "parentProfileName" : "",
      "profileName" : "HCL_findProductsByCategory",
      "lookupProfileName" : "HCL_findCatalogEntryByIdForBrowse",
      "indexName" : "product",
      "query" : {

Lookup profiles can be defined in the search profile using the lookupProfileNames property, with a key value pair. Lookup profiles are used to fetch the product sku/variant sku/component merchandising association details for the product. For example, suppose you call the productview/byIds API with the profile HCL_findProductByIds_Details. This profile has post-processors defined to fetch the SKU, component, and merchandising association details. These post-processors use a profile to fetch the respective details.

The HCL_findProductByIds_Details profile is configured with lookup profiles as follows. If you override the profile, ensure that you do not change the LookupProfileNames key. If no lookup profile is specified the call will fall back to the default profiles which are mentioned below in the default HCL_findProductByIds_Details profile.
{
     "profileName" : "HCL_findProductByIds_Details",
     
     "indexName" : "product",

     "lookupProfileNames" : {
          "productSKU" : "HCL_findCatalogEntrySKUs",
          "variantSKU" : "HCL_findCatalogEntrySKUsByVariantIds",
          "component" : "HCL_findCatalogEntryComponents",
          "merchandisingAssoc" : "HCL_findCatalogEntryAssociatedMerchandising"
      },

     "query" : {
Note:
SearchCatalogEntryViewSKUQueryPostprocessor
This post processor uses below tow profile to fetch the product and variant SKU details:
HCL_findCatalogEntrySKUs
HCL_findCatalogEntrySKUsByVariantIds
SearchCatalogEntryViewComponentsQueryPostprocessor
This post processor uses the HCL_findCatalogEntryComponents profile to fetch component details.
SearchCatalogEntryViewMerchandisingAssocQueryPostprocessor
This post processor uses the HCL_findCatalogEntryAssociatedMerchandising profile to fetch merchandising association details.
  • Search profiles can be customized to make use of customized lookup profiles in case you need to limit the response fields returned for sku/component/merchandising details.
  • While customizing lookup profile, do not remove the response field that starts with “relationship” from the profile.
  • lookupProfileName and lookupProfileNames are different. lookupProfileName is used to fetch the product details when a Hero Product Image is enabled, based on the sku parentId details. lookupProfileNames is used to fetch the sku/variant/component and merchandising association details.
  • You can use the provided sample custom profiles to help you limit the number of fields returned by the productview/byIds API for sku/component/merchandising details.

Using a custom lookup profile

You can create an independent custom profile without inheriting any default settings. Creating a standalone custom profile will help with editing any fields that are not required for your customers, such as response fields, providers, or post-processors. By restricting the fields you use, you can reduce attribute payload and improve efficiency. For example, you could create the following profile (the parentProfileName parameter is not a mandatory field and can be left blank):
{ "parentProfileName" : "", "profileName" : "X_findCatalogEntrySKUs",
"indexName" : "product", "query" : { "params" : [
{"maxRows" : "1200"}

], "queryFields" : ["relationship.product.id"], "provider" : [ 
      "com.hcl.commerce.search.internal.expression.provider.SearchInventoryExpressionProvider", 
      "com.hcl.commerce.search.internal.expression.provider.SearchByPublishedEntryOnlyExpressionProvider", 
      "com.hcl.commerce.search.internal.expression.provider.SearchByStorePathExpressionProvider", 
      "com.hcl.commerce.search.internal.expression.provider.SearchByCatalogExpressionProvider", 
      "com.hcl.commerce.search.internal.expression.provider.SearchByLanguageExpressionProvider", 
      "com.hcl.commerce.search.internal.expression.provider.SearchProductEntitlementExpressionProvider"], 
"preprocessor" : [], 
"postprocessor" : [
      "com.hcl.commerce.search.internal.expression.postprocessor.SearchMainCatalogEntryViewResultQueryPostprocessor",
      "com.hcl.commerce.search.internal.expression.postprocessor.SearchCatalogEntryViewPriceQueryPostprocessor",
      "com.hcl.commerce.search.internal.expression.postprocessor.SearchCatalogEntryViewUserDataQueryPostprocessor"  ], 
"responseFields" : [ "id.catentry","id.store","buyable","id.catalog","identifier.sku.raw","name.raw","name.override.raw",
"description.raw","description.override.raw","url.thumbnail","url.override.thumbnail", "url.image","url.override.image","keyword.text",
"manufacturer.raw","type","prices.","path.","relationship.product.id", "relationship.item.id","attribute.source","url.seo","attachments.", 
"images." ]
 } 
}
Note: You must restart your Query service containers after adding or updating a custom search profile.

You can also override default profiles by creating a custom profile using the same name as a default profile. If a custom profile with the same name as a default profile is available, the custom profile is used and the default profile is ignored.