A message is published to this topic when search results are retrieved or when an error is returned while searching for a product. If search results are retrieved successfully, those results are published with the message. If an error occurs, the error is published with the message.
$.Topic(pubsub.topicNames.SEARCH_RESULTS_UPDATED).publishWith(searchResults, message);
Arguments
searchResults: The contents of this argument vary depending on whether the search was successful or not. If the search was successful, the argument consists of a JSON object that includes the search results and meta-data about the search, for example:
{
searchResults : Array[5],
isNewSearch:false,
navigation : Array[5],
pageCount : 15,
pagingActionTemplate : JSONObject,
recordOffSet : 0,
recordsPerPage : 5,
searchAdjustments :JSONObject,
totalRecordsFound : 74
breadcrumbs:JSONObject
}The properties in the successful search JSON object include:
searchResults: An array that contains the search results. The following code sample shows what an item in that array might look like:
{
"product.category" : ["Cameras and Camcorders"],
"product.language" : ["en"],
"record.type" : ["camera", "sku-camera"],
"sku.listingId" : ["camera_1"],
"product.priceRange" : ["JPY0 - JPY9"],
"sku.activePrice" : ["3.990000"],
"product.creationDate" : ["1466057558000"],
"sku.url" : ["atgrep:/ProductCatalog/sku-camera/
camerasku_1_55?_product=camera_1&locale=en&priceListPair=
salePrices_listPrices"],
"product.priceListPair" : ["salePrices_listPrices"],
"product.active" : ["1"],
"sku.salePrice" : ["3.990000"],
"sku.creationDate" : ["1466057558000"],
"record.source" : ["ProductCatalog"],
"product.url" : ["atgrep:/ProductCatalog/sku-camera/
camerasku_1_55?_product=camera_1&locale=en&priceListPair=
salePrices_listPrices"],
"sku.availabilityStatus" : ["OUTOFSTOCK"],
"parentCategory.displayName" : ["Cameras and Camcorders"],
"Endeca.Document.Language" : ["en"],
"product.daysAvailable" : ["0"],
"record.type.raw" : ["camera", "sku-camera"],
"sku.baseUrl" : ["atgrep:/ProductCatalog/sku-camera/
camerasku_1_55"],
"product.dateAvailable" : ["1466057558000"],
"sku.repositoryId" : ["camerasku_1_55"],
"product.baseUrl" : ["atgrep:/ProductCatalog/sku-camera/
camerasku_1_55"],
"sku.listPrice" : ["399.990000"],
"sku.onSale" : ["0"],
"record.id" : ["sku-camera-camerasku__1__55..camera__1.en.
salePrices__listPrices"],
"product.route" : ["/digital-compact-system-camera/product/
camera_1"],
"product.longDescription" : ["This digital compact system camera
14.1-megapixel,\n 4/3 Live MOS sensor allows you to
capture sharp photos and record high-definition video footage with
up\n to 1920 x 1080 resolution. Built-in Wi-Fi lets
you easily share stored files.\n "],
"sku.listingOptionIndex" : ["10000"],
"id" : ["camera_1"],
"repositoryId" : ["camera_1"],
"displayName" : "Digital Compact System Camera",
"shippingSurcharge" : 0,
"listPrice" : 399.99,
"salePrice" : null,
"route" : "/digital-compact-system-camera/product/camera_1",
"primaryImageAltText" : ["Digital Compact System Camera"],
"primaryImageTitle" : ["Digital Compact System Camera"],
"primaryLargeImageURL" : "/ccstore/v1/images/?source=
/file/v2/products/OM_D_E_M10_LARGE.jpg&height=940&width=940",
"primarySmallImageURL" : "/ccstore/v1/images/?source=
/file/v2/products/OM_D_E_M10_LARGE.jpg&height=300&width=300",
"primaryThumbImageURL" : "/ccstore/v1/images/?source=
/file/v2/products/OM_D_E_M10_LARGE.jpg&height=100&width=100",
"primaryMediumImageURL" : "/ccstore/v1/images/?source=
/file/v2/products/OM_D_E_M10_LARGE.jpg&height=475&width=475",
"primaryFullImageURL" : "/ccstore/v1/images/?source=
/file/v2/products/OM_D_E_M10_LARGE.jpg",
"childSKUs" : [{
"salePrice" : "3.990000",
"listPrice" : "399.990000",
"repositoryId" : ["camerasku_1_55"],
"largeImage" : {
"url" : ""
},
"smallImage" : {
"url" : ""
},
"thumbnailImage" : {
"url" : ""
}
}
],
"maxActivePrice" : "399.990000",
"minActivePrice" : "3.990000"
}isNewSearch: A Boolean value that specifies whether this is a new search or not.navigation: An array ofrefinementselements, each of which contains the refinements available for a given dimension. These refinements are used to present the shopper with a set of refinement links that she can use to further refine the current search results. For example, the following JSON sample shows an excerpt of the refinements available for theproduct.categorydimension:
"refinements": [
{
"multiSelect": false,
"navigationState":
"?N=4058976224&Nr=AND%28product.priceListPair%3AsalePrices_listPrices
%2Cproduct.language%3Aen%29&Nrpp=12&Ntl=en&Ntt=cam&language=en&
searchType=simple&visitId=-14ddf4e9%3A156217da656%3A-582e-10.170.102.150&
visitorId=1298EspxGMOA_YEnEkrCS9sDr1JYUdQ6jpex06ADSHQzGuU30A4",
"contentPath": "\/guidedsearch",
"count": 2,
"@class": "com.endeca.infront.cartridge.model.Refinement",
"siteRootPath": "\/pages\/Default\/services",
"siteState": {
"contentPath": null,
"siteId": "@error:siteNotFound",
"@class": "com.endeca.infront.site.model.SiteState",
"siteDisplayName": null,
"validSite": false,
"properties": {
},
"siteDefinition": null,
"matchedUrlPattern": null
},
"label": "All Products",
"properties": {
"dimval.prop.category.ancestorCatalogIds": "cloudLakeCatalog",
"dimval.prop.category.rootCatalogId": "cloudLakeCatalog",
"dimval.prop.displayName_en": "All Products",
"dimval.prop.category.repositoryId": "AllProdPagination",
"dimval.prop.category.catalogs.repositoryId":
"cloudCatalog,cloudLakeCatalog",
"record.id":
"atgrep:\/ProductCatalog\/category\/AllProdPagination?
categoryPath=\/AllProdPagination",
"DGraph.Spec": "AllProdPagination"
}
},
{
"multiSelect": false,
"navigationState":
"?N=3881554706&Nr=AND%28product.priceListPair%3AsalePrices_listPrices%
2Cproduct.language%3Aen%29&Nrpp=12&Ntl=en&Ntt=cam&language=en&
searchType=simple&visitId=-14ddf4e9%3A156217da656%3A-582e-10.170.102.150&
visitorId=1298EspxGMOA_YEnEkrCS9sDr1JYUdQ6jpex06ADSHQzGuU30A4",
"contentPath": "\/guidedsearch",
"count": 1,
"@class": "com.endeca.infront.cartridge.model.Refinement",
"siteRootPath": "\/pages\/Default\/services",
"siteState": {
"contentPath": null,
"siteId": "@error:siteNotFound",
"@class": "com.endeca.infront.site.model.SiteState",
"siteDisplayName": null,
"validSite": false,
"properties": {
},
"siteDefinition": null,
"matchedUrlPattern": null
},
"label": "Blockbuster",
"properties": {
"dimval.prop.category.ancestorCatalogIds": "cloudLakeCatalog",
"dimval.prop.category.rootCatalogId": "cloudLakeCatalog",
"dimval.prop.displayName_en": "Blockbuster",
"dimval.prop.category.repositoryId": "topLeaf",
"dimval.prop.category.catalogs.repositoryId":
"cloudCatalog,SiteContextDummyCatalog,ClassicalMoviesCatalog,
cloudLakeCatalog",
"record.id": "atgrep:\/ProductCatalog\/category\/topLeaf?
categoryPath=\/topLeaf",
"DGraph.Spec": "topLeaf"
}
},
…Additional refinements here…
],
"multiSelect": false,
"@type": "RefinementMenu",
"name": "product.category",
"ancestors": [
],
"displayName": "Category",
"dimensionName": "product.category",
"whyPrecedenceRuleFired": null
},pageCount: The total number of pages of records. Each page contains the number of records specified byrecordsPerPage.pagingActionTemplate: A JSON object that returns data used to retrieve the next page of search results.
"pagingActionTemplate" : {
"navigationState" :
"?&Ntl=en&Ntt=camera&language=en&searchType=simple",
"contentPath" : "/guidedsearch",
"@class" :
"com.endeca.infront.cartridge.model.NavigationAction",
"siteRootPath" : "/pages/Default/services",
"siteState" : {
"contentPath" : null,
"siteId" : "@error:siteNotFound",
"@class" : "com.endeca.infront.site.model.SiteState",
"siteDisplayName" : null,
"validSite" : false,
"properties" : {},
"siteDefinition" : null,
"matchedUrlPattern" : null
},
"label" : null
}recordOffset: Identifies the page being viewed. For example, if you have 12 records per page andrecordOffset = 12, then page 2 is being viewed.recordsPerPage: The number of records to show per page, used for pagination controls.searchAdjustments: A JSON object that contains information about any adjustments made to the original search terms.@type: Identifies the search adjustments portion of the JSON response.originalTerms: The original search terms as entered by the shopper, minus any wildcards.originalSearchTerms: The original search terms as entered by the shopper, including any wildcards.
totalRecordsFound: The total number of records that match the search criteria.breadcrumbs: A JSON object that provides details on the user actions that led to the current navigation state, for example:
"breadcrumbs" : {
"removeAllAction" : {
"navigationState" : "?Ntl=en&language=en&searchType=simple&
visitId=null&visitorId=null",
"contentPath" : "/guidedsearch",
"@class" :
"com.endeca.infront.cartridge.model.NavigationAction",
"siteRootPath" : "/pages/Default/services",
"siteState" : {
"contentPath" : null,
"siteId" : "@error:siteNotFound",
"@class" : "com.endeca.infront.site.model.SiteState",
"siteDisplayName" : null,
"validSite" : false,
"properties" : {},
"siteDefinition" : null,
"matchedUrlPattern" : null
},
"label" : null
},
"refinementCrumbs" : [],
"geoFilterCrumb" : null,
"@type" : "Breadcrumbs",
"endeca:auditInfo" : {
"ecr:innerPath" : "breadcrumbs",
"ecr:resourcePath" : "/pages/Default/services/guidedsearch"
},
"searchCrumbs" : [{
"@class" :
"com.endeca.infront.cartridge.model.SearchBreadcrumb",
"terms" : "camera",
"removeAction" : {
"navigationState" :
"?Nr=AND%28product.priceListPair%3AsalePrices_listPrices%
2Cproduct.language%3Aen%29&Nrpp=12&Ntl=en&language=en&
searchType=simple&visitId=null&visitorId=null",
"contentPath" : "/guidedsearch",
"@class" :
"com.endeca.infront.cartridge.model.NavigationAction",
"siteRootPath" : "/pages/Default/services",
"siteState" : {
"contentPath" : null,
"siteId" : "@error:siteNotFound",
"@class" :
"com.endeca.infront.site.model.SiteState",
"siteDisplayName" : null,
"validSite" : false,
"properties" : {},
"siteDefinition" : null,
"matchedUrlPattern" : null
},
"label" : null
},
"correctedTerms" : null,
"key" : "All",
"matchMode" : "allpartial"
}
],
"rangeFilterCrumbs" : []
}When the search has failed, the searchResults object contains details about the error, including:
message: The runtime error message that indicates that the search has failed.status: Any HTTP status codes associated with the failed request.errorCode: An Commerce Cloud error code, which may beGET_SEARCH_INTERNAL_ERROR = 31040,SEARCH_ADMIN_INTERNAL_ERROR = 31041, orSEARCH_ADMIN_INDEXING_INTERNAL_ERROR = 31042.
For example:
{
"message":"Unable to perform a search at this time",
"status":"500",
"errorCode":"31040"
}message: The second argument returned for the SEARCH_RESULTS_UPDATED topic contains a JSON array that includes either a success or failure message and the SearchViewModel object, for example:
[{
message: "success",
requestor: SearchViewModel
}]In the case of a failed search, this message property has a value of fail.
[{"message":"fail"}]Memory enabled
Yes

