CommerceSearch Class

Get sort rules for the live search index. Get product search suggestions. Search products.

Namespace

ConnectApi

CommerceSearch Methods

These methods are for CommerceSearch. All methods are static.

getSortRules(webstoreId)

Get sort rules for the live index.

API Version

52.0

Available to Guest Users

52.0

Requires Chatter

No

Signature

public static ConnectApi.SortRulesCollection getSortRules(String webstoreId)

Parameters

webstoreId
Type: String
ID of the webstore.

Return Value

Type: ConnectApi.SortRulesCollection

getSuggestions(webstoreId, effectiveAccountId, searchTerm, maxResults)

Get suggestions for product searches.

API Version

52.0

Available to Guest Users

52.0

Requires Chatter

No

Signature

public static ConnectApi.ProductSearchSuggestionsResults getSuggestions(String webstoreId, String effectiveAccountId, String searchTerm, Integer maxResults)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
searchTerm
Type: String
Search term with up to 100 characters. If specified, the service returns autocomplete suggestions from the user’s recent searches. If unspecified, the service returns suggestions from the user’s recent searches.
maxResults
Type: Integer
Maximum number of suggestions. Values are from 1 through 10. If unspecified, defaults to 10.

getSuggestions(webstoreId, effectiveAccountId, searchTerm, maxResults, includeSuggestedProducts, maxSuggestedProducts)

Get suggestions for product searches.

API Version

58.0

Available to Guest Users

58.0

Requires Chatter

No

Signature

public static ConnectApi.ProductSearchSuggestionsResults getSuggestions(String webstoreId, String effectiveAccountId, String searchTerm, Integer maxResults, Boolean includeSuggestedProducts, Integer maxSuggestedProducts)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
searchTerm
Type: String
Search term with up to 100 characters. If specified, the service returns autocomplete suggestions from the user’s recent searches. If unspecified, the service returns suggestions from the user’s recent searches.
maxResults
Type: Integer
Maximum number of suggestions. Values are from 1 through 10. If unspecified, defaults to 10.
includeSuggestedProducts
Type: Boolean
Specifies whether a search term returns product suggestions (true) or not (false). If unspecified, defaults to false. If true, the service returns the suggested product IDs.
maxSuggestedProducts
Type: String
Maximum number of product suggestions. Values are from 1 through 10. If unspecified, defaults to 4.

searchProducts(webstoreId, effectiveAccountId, productSearchInput)

Search products.

API Version

52.0

Available to Guest Users

52.0

Requires Chatter

No

Signature

public static ConnectApi.ProductSearchResults searchProducts(String webstoreId, String effectiveAccountId, ConnectApi.ProductSearchInput productSearchInput)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
productSearchInput
Type: ConnectApi.ProductSearchInput
A ConnectApi.ProductSearchInput body with either a category ID or search terms.

Return Value

Type: ConnectApi.ProductSearchResults

Usage

Searching products respects buyer View Product entitlements and only users entitled to view product data can access this resource.