Feature Pack 7

ProductViewHandler (Search)

This class provides RESTful services to get the ProductView details. It performs the services on the WebSphere Commerce Search server.

Instead of using the /wcs/resources/store/ URI, the Search REST service URI must contain /search/resources/store/ under the default configuration.

The supported search profiles are identified at runtime according to the Search-REST/WEB-INF/config/com.ibm.commerce.rest/wc-rest-resourceconfig.xml file. For more information about the WebSphere Commerce search profiles, see WebSphere Commerce search profiles.

Feature Pack 7 or later

WebSphere Commerce search REST APIs

The REST classes that are denoted by (Search) in the title are applicable to the WebSphere Commerce search server.

They have the following benefits over the BOD-based REST services:
  • The services are served by the search server and can be separately scaled from the WebSphere Commerce server. Instead, the WebSphere Commerce server is used for processing transactional requests.
  • The WebSphere Commerce search REST API is built to extract data from Solr queries, avoiding the need for the BOD mediation layer.
Note: Attributes that are not managed by the Attribute Dictionary are not indexed or returned by default in search-based REST responses. You must either migrate your attributes to the Attribute Dictionary, or create a custom postprocessor to fetch the applicable attributes to catalog entries in the response, and then add them to the search-based REST response.
Method Name HTTP Method URL Query Parameters Description Authentication Example
findProductsBySearchTerm GET store/{storeId}/productview/bySearchTerm/{searchTerm} searchSource={searchSource}& searchType={searchType}& intentSearchTerm={intentSearchTerm}& originalSearchTerm={originalSearchTerm}& categoryId={categoryId} facet={facet}*& facetLimit={facetLimit}*& advancedFacetList={advancedFacetList}& filterFacet={filterFacet}& filterTerm={filterTerm}& filterType={filterType}& manufacturer={manufacture}& minPrice={minPrice}& maxPrice={maxPrice}& physicalStoreId={physicalStoreId}*& pageSize={pageSize}& pageNumber={pageNumber}& orderBy={orderBy}& landingPage=true& searchTerm={searchTerm}& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter}. Gets product details based on a search term. No,HTTP Sample
findProductById GET store/{storeId}/productview/byId/{productId} priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} Gets product details based on the product ID. No,HTTP Sample
findProductsByIds GET store/{storeId}/productview/byIds id={productId}*& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} Gets product details based on the product IDs. No,HTTP Sample
findProductByPartNumber GET store/{storeId}/productview/{partNumber} partNumber={partNumber}& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} Gets products by part number. No,HTTP Sample
findProductsByCategory GET store/{storeId}/productview/byCategory/{categoryId} facet={facet}*& facetLimit={facetLimit}*& advancedFacetList={advancedFacetList}& filterFacet={filterFacet}& filterTerm={filterTerm}& filterType={filterType)& manufacturer={manufacturer}& minPrice={minPrice}& maxPrice={maxPrice}& pageNumber={pageNumber}& pageSize={pageSize}& orderBy={orderBy}& searchType={searchType}& searchSource={searchSource}& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} Gets products by the parent category ID. This API will return all products under this category and does not return products under any subcategory by default. To enable deep search for searching products in all subcategories, the category being searched must be enabled using the Expanded category navigation store function in the Management Center. No,HTTP Sample
Where the following Query Parameters are defined as:
searchSource
Mapped to _wcf.search.source.
For findProductsByCategory, the default value is N for shallow search navigation. All other values will result in expanded search in subcategories.
For findProductsBySearchTerm, it is used as one of the conditions to log search term statistics for 3 cases:
  • A: Advanced search.
  • Q: Quick search.
  • S: Spell check, used with searchType.
originalSearchTerm
Mapped to _wcf.search.originalterm.
intentSearchTerm
Mapped to _wcf.search.intent.term.
categoryId
Mapped to _wcf.search.category. The category ID to use for the search.
searchType
Mapped to _wcf.search.type. It is a numeric string with 2 purposes:
  • 1: Control which operator: ANY, OR, AND.
  • 2: Control what data to be returned.
physicalStoreIds
The list of physical store location IDs obtained from the cookie container.
facet
Mapped to _wcf.search.facet. The multiple name-value pairs of facet names define what facets to be returned in the facet section.
If not specified, all predefined facets will be returned.
Large numbers of facets can reduce search performance. The facet parameters allow you to filter the facet results to highlight top choices or reduce the number of facets that are returned.
facetLimit
The multiple name-value pairs of facet limits defining the maximum number of items to be returned under each facet.
The sequence of limits is accepted with the sequence of facet name-value pairs.
advancedFacetList
Mapped to _wcf.search.advanced.facet.
filterFacet
Mapped to _wcf.search.exclude.facet. The facet name to be used for filtering the search results.
filterTerm
Mapped to _wcf.search.exclude.term. The string used to exclude the results containing this string.
filterType
Mapped to _wcf.search.exclude.type. It is used for the following advanced search options:
  • 0: Search for any match.
  • 1: Search for exact match.
  • 2: Search for all matches.
manufacturer
Mapped to _wcf.search.manufacturer. Returns items with this brand or manufacturer name.
minPrice
Mapped to _wcf.search.price.minimum. Returns items with this minimum price.
maxPrice
Mapped to _wcf.search.price.maximum. Returns items with this maximum price.
pageNumber
Mapped to _wcf.search.page.number. Returns results of the page number, starting from 1, if there are more results than the pageSize number.
This parameter is used with the pageSize parameter.
The default value is 1.
pageSize
Mapped to _wcf.search.page.size. Returns up to the maximum number of items (immediate child categories) in the response.
All items will be returned if this parameter is not specified.
orderBy
Mapped to _wcs.search.sort:
  • 1: Sort by brand/manufacturer name in ascending alphabetical order.
  • 2: Sort by category name in ascending alphabetical order.
  • 3: Sort by price in ascending order.
  • 4: Sort by price in descending order.
These values are configurable in the WebSphere Commerce search configuration file. For more information, see WebSphere Commerce search configuration file (wc-search.xml) (Search EAR).
id
The repeated value list of product IDs. For example, id=10001&id=10002.
landingPage
The landing page information will be returned if it is available and the value is true.
The default value is false.
searchTerm
The optional searchTerm parameter that will replace the {searchTerm} value in the context path parameter. It is used to avoid potential limitations of the special characters that are part of the context path.
partNumber
The optional partNumber parameter that will replace the {partNumber} value in the context path parameter. It is used to avoid potential limitations of the special characters that are part of the context path.
priceMode
The price mode to be used to calculate the price when requesting the product information.
checkEntitlement
The boolean flag to indicate whether to check entitlement of the caller. To check entitlement, the flag must be set to true.
The default value is false.
attachmentFilter
The filter string to include or exclude attachment details based on the usage of the attachment, with inclusion and exclusion being used for the filtering list.
For example:
  • attachmentFilter=swatchImages includes all attachments with swatch images as the attachment usage. Inclusion is assumed by default when not specified.
  • attachmentFilter=exclusion:swatchImages excludes all attachments with swatch images as the attachment usage.
Note: JSON is the only response format supported by the WebSphere Commerce search ProductViewHandler by default.
Feature Pack 7 or later

WebSphere Commerce search query parameters

The following query parameters are specific to the WebSphere Commerce search REST API, such as the CategoryViewHandler, ProductViewHandler, and SiteContentHandler resources.
profileName
An optional search profile name that can be specified. It must be listed under the Search-Rest/WEB-INF/config/com.ibm.commerce.rest/wc-rest-resourceconfig.xml configuration file for the resource that is being requested.
For example, for a service with the following URI:

<GetUri uri="store/{storeId}/categoryview/byId/{categoryId}"
description="Get category by unique ID"
searchProfile="IBM_findCategoryByUniqueIds,IBM_Admin_findCategoryByIds"/>
The IBM_Admin_findCategoryByIds search profile can be specified, while IBM_findCategoryByUniqueIds is the default search profile when the profileName is not specified.
responseTemplate
The structure of response that is being used.
A value of 0 generates BOD-like responses for the responsive Aurora starter store, while a value of 1 generates REST responses.
The default value is 0.
Field name mapping definitions are used to leverage different fields in responses. The mappings are divided into the following categories:
CatalogEntryView
Maps the catalog entry section inside the Product REST responses.
CatalogGroupView
Maps the category section inside the Category REST responses.
WebContentView
Maps the web content section inside the SiteContent REST responses.
The mappings are stored in the Search_eardir/xml/config/com.ibm.commerce.catalog/wc-component.xml file.