CommerceSearch Class
Get sort rules for the live search index. Get product search suggestions. Search products.
These methods are for CommerceSearch. All methods are static.
-
Get sort rules for the live index.
-
getSuggestions(webstoreId, effectiveAccountId, searchTerm, maxResults)
Get suggestions for product searches.
-
Get suggestions for product searches.
-
Get suggestions for product searches.
-
Get suggestions for product searches.
-
searchProducts(webstoreId, effectiveAccountId, productSearchInput)
Search products.
Get sort rules for the live index.
52.0
52.0
No
public static ConnectApi.SortRulesCollection getSortRules(String webstoreId)
- webstoreId
Type: String
ID of the webstore.
Type: ConnectApi.SortRulesCollection
Get suggestions for product searches.
52.0
52.0
No
public static ConnectApi.ProductSearchSuggestionsResults getSuggestions(String webstoreId, String effectiveAccountId, String searchTerm, Integer maxResults)
- 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.
Type: ConnectApi.ProductSearchSuggestionsResults
Get suggestions for product searches.
58.0
58.0
No
public static ConnectApi.ProductSearchSuggestionsResults getSuggestions(String webstoreId, String effectiveAccountId, String searchTerm, Integer maxResults, Boolean includeSuggestedProducts, Integer maxSuggestedProducts)
- 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 tofalse. Iftrue, 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 6.
Type: ConnectApi.ProductSearchSuggestionsResults
Get suggestions for product searches.
59.0
50.0
No
public static ConnectApi.ProductSearchSuggestionsResults getSuggestions(String webstoreId, String effectiveAccountId, String searchTerm, Integer maxResults, Boolean includeSuggestedProducts, Integer maxSuggestedProducts, List<String> suggestedFields)
- 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 tofalse. Iftrue, the service returns the suggested product IDs.- maxSuggestedProducts
Type: Integer
Maximum number of product suggestions. Values are from 1 through 10. If unspecified, defaults to 6.
- suggestedFields
Type: List<String>
List of field names recommended for inclusion in the response based on the search context.
Type: ConnectApi.ProductSearchSuggestionsResults
Get suggestions for product searches.
64.0
50.0
No
public static ConnectApi.ProductSearchSuggestionsResults getSuggestions(String webstoreId, String effectiveAccountId, String searchTerm, Integer maxResults, Boolean includeSuggestedProducts, Integer maxSuggestedProducts, List<String> suggestedFields, Boolean includeSuggestedTerms, String popularProductsCategoryId)
- 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 tofalse. Iftrue, the service returns the suggested product IDs.- maxSuggestedProducts
Type: Integer
Maximum number of product suggestions. Values are from 1 through 10. If unspecified, defaults to 6.
- suggestedFields
Type: List<String>
List of field names recommended for inclusion in the response based on the search context.
- includeSuggestedTerms
Type: Boolean
Specifies whether a request returns search term suggestions (
true) or not (false). If unspecified, defaults totrue. The value returned can include recent or popular term suggestions. At least one ofincludeSuggestedTermsorincludeSuggestedProductsmust be set totrue.- popularProductsCategoryId
Type: String
ID of the category that identifies a store's popular products. This category can be configured on the search input component. If
popularProductsCategoryIdis populated, the search term for a request is empty, andincludeSuggestedProductsistrue, product suggestions are returned from the specified category. If a search term is specified,popularProductsCategoryIdis ignored and suggestions are based on the search term instead.
Type: ConnectApi.ProductSearchSuggestionsResults
Search products.
52.0
52.0
No
public static ConnectApi.ProductSearchResults searchProducts(String webstoreId, String effectiveAccountId, ConnectApi.ProductSearchInput productSearchInput)
- 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.ProductSearchInputA
ConnectApi.ProductSearchInputbody with either a category ID or search terms.
Type: ConnectApi.ProductSearchResults
Searching products respects buyer View Product entitlements and only users entitled to view product data can access this resource.