SiteContentHandler (Search)
This class provides RESTful services to get resource details for site content. It performs the services on the WebSphere Commerce search server.
Instead of using the /wcs/resources/store/ URI, the 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.
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 |
---|---|---|---|---|---|---|
findWebContentsBySearchTerm | GET | store/{storeId}/sitecontent/webContentsBySearchTerm/{searchTerm} | orderBy={orderBy}& pageNumber={pageNumber}& pageSize={pageSize}& searchTerm={searchTerm} | Search unstructured content details for search result page based on a search term. | No,HTTP | Sample |
findKeywordSuggestionsByTerm | GET | store/{storeId}/sitecontent/keywordSuggestionsByTerm/{term} | count={count}& sort={termsSort}& searchTerm={searchTerm} | Auto-suggest terms with type ahead search. | No,HTTP | Sample |
findAllCategorySuggestions | GET | store/{storeId}/sitecontent/categorySuggestions | WebSphere Commerce search query parameters&catalogId={catalogId} | Gets all the category suggestions for auto-suggest with type ahead search | No,HTTP | Sample |
findAllBrandSuggestions | GET | store/{storeId}/sitecontent/brandSuggestions | WebSphere Commerce search query parameters&catalogId={catalogId} | Gets all the brand suggestions for auto-suggest with typeahead search. | No,HTTP | Sample |
findAllWebContentSuggestions | GET | store/{storeId}/sitecontent/webContentSuggestions | WebSphere Commerce search query parameters&catalogId={catalogId} | Gets all the unstructured content suggestions for auto-suggest with typeahead search. | No,HTTP | Sample |
findSuggestions | GET | /search/resources/store/{storeid}/sitecontent/suggestions | WebSphere Commerce search query parameters&catalogId={catalogId} | Merges the following services:
|
No,HTTP |
Where the following Query Parameters are defined as:
- 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.
- 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.
- pageSize
- Mapped to _wcf.search.page.size. Returns up to the maximum number of items (immediate child categories) in the response.
- 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.
- limit
- The number of suggested keywords to be returned.
- sort
- The sorting to be used in the returned result, either
count
orindex
.
Note:
- JSON is the only response format supported by the WebSphere Commerce search SiteContentHandler by default.
- The following methods do not support the catalogId query
parameter:
- findWebContentsBySearchTerm
- findKeywordSuggestionsByTerm
- findAllWebContentSuggestions
- The findKeywordSuggestionsByTerm method supports the catalogId query parameter in Feature Pack 8.
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.
- responseTemplate
- The structure of response that is being used.