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
https://data_environment_hostname:30921/search/resources/api/v2/documents/profiles/profileName
For
the full REST API specification, see the Query REST API.{
"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.
Lookup profiles
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.
{
"profileName" : "HCL_findProductByIds_Details",
"indexName" : "product",
"lookupProfileNames" : {
"productSKU" : "HCL_findCatalogEntrySKUs",
"variantSKU" : "HCL_findCatalogEntrySKUsByVariantIds",
"component" : "HCL_findCatalogEntryComponents",
"merchandisingAssoc" : "HCL_findCatalogEntryAssociatedMerchandising"
},
"query" : {
- 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
{ "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." ]
}
}
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.