Class ProductSearchModel
dw.catalog
Class ProductSearchModel
Object
dw.catalog.SearchModel
dw.catalog.ProductSearchModel
The class is the central interface to a product search result and a product search refinement. It also provides utility methods to generate a search URL.
Constants
CATEGORYID_PARAMETER  :  String = "cgid"
URL Parameter for the category ID
MAXIMUM_PRODUCT_IDS  :  Number = 30
The maximum number of product IDs that can be passed to setProductIDs(List)
PRICE_MAX_PARAMETER  :  String = "pmax"
URL Parameter for the maximum price
PRICE_MIN_PARAMETER  :  String = "pmin"
URL Parameter for the minimum price
PRODUCTID_PARAMETER  :  String = "pid"
URL Parameter for the product ID
PROMOTION_PRODUCT_TYPE_ALL  :  String = "all"
constant indicating that all related products should be returned for the next product search by promotion ID
PROMOTION_PRODUCT_TYPE_BONUS  :  String = "bonus"
constant indicating that only bonus products should be returned for the next product search by promotion ID. This constant should be set using setPromotionProductType(String) when using the search model to find the available list of bonus products for a Choice of Bonus Product (Rule) promotion, along with setPromotionID(String).
PROMOTION_PRODUCT_TYPE_DISCOUNTED  :  String = "discounted"
constant indicating that only discounted products should be returned for the next product search by promotion ID
PROMOTION_PRODUCT_TYPE_PARAMETER  :  String = "pmpt"
URL Parameter for the promotion product type
PROMOTION_PRODUCT_TYPE_QUALIFYING  :  String = "qualifying"
constant indicating that only qualifying products should be returned for the next product search by promotion ID
PROMOTIONID_PARAMETER  :  String = "pmid"
URL Parameter for the promotion ID
REFINE_NAME_PARAMETER_PREFIX  :  String = "prefn"
URL Parameter prefix for a refinement name
REFINE_VALUE_PARAMETER_PREFIX  :  String = "prefv"
URL Parameter prefix for a refinement value
SORT_BY_PARAMETER_PREFIX  :  String = "psortb"
URL Parameter prefix for a refinement value
SORT_DIRECTION_PARAMETER_PREFIX  :  String = "psortd"
URL Parameter prefix for a refinement value
SORTING_OPTION_PARAMETER  :  String = "sopt"
URL Parameter prefix for a sorting option
SORTING_RULE_PARAMETER  :  String = "srule"
URL Parameter prefix for a sorting rule
Properties
category  :  Category  (Read Only)
The category object for the category id specified in the query. If a category with that id doesn't exist or if the category is offline this method returns null.
categoryID  :  String
The category id that was specified in the search query.
categorySearch  :  boolean  (Read Only)
The method returns true, if this is a pure search for a category. The method checks, that a category ID is specified and no search phrase is specified.
deepestCommonCategory  :  Category  (Read Only)
The deepest common category of all products in the search result. In case of an empty search result the method returns the root category.
effectiveSortingRule  :  SortingRule  (Read Only)
The sorting rule used to order the products in the results of this query, or null if no search has been executed yet. In contrast to getSortingRule(), this method respects explicit sorting rules and sorting options and rules determined implicitly based on the refinement category, keyword sorting rule assignment, etc.
orderableProductsOnly  :  boolean
Get the flag indicating whether unorderable products should be excluded when the next call to getProducts() is made. If this value has not been previously set, then the value returned will be based on the value of the search preference.
pageMetaTags  :  Array  (Read Only)
All page meta tags, defined for this instance for which content can be generated.

The meta tag content is generated based on the product listing page meta tag context and rules. The rules are obtained from the current category context or inherited from the parent category, up to the root category.

personalizedSort  :  boolean  (Read Only)
The method indicates if the search result is ordered by a personalized sorting rule.
priceMax  :  Number
The maximum price by which the search result is refined.
priceMin  :  Number
The minimum price by which the search result is refined.
productID  :  String
The product id that was specified in the search query.
Deprecated:
Please use getProductIDs() instead
productIDs  :  List
A list of product IDs that were specified in the search query or an empty list if no product ID set.
products  :  Iterator  (Read Only)
All products in the search result.
Note that products that were removed or went offline since the last index update are not included in the returned set.
Deprecated:
This method should not be used because loading Products for each result of a product search is extremely expensive performance-wise. Please use getProductSearchHits() to iterate ProductSearchHits instead.
productSearchHits  :  Iterator  (Read Only)
The product search hits in the search result.
Note that method does also return search hits representing products that were removed or went offline since the last index update, i.e. you must implement appropriate checks before accessing the product related to the search hit instance (see ProductSearchHit.getProduct)
promotionID  :  String
The promotion id that was specified in the search query or null if no promotion id set. If multiple promotion id's specified the method returns only the first id. See setPromotionIDs(List) and getPromotionIDs().
promotionIDs  :  List
A list of promotion id's that were specified in the search query or an empty list if no promotion id set.
promotionProductType  :  String
The promotion product type specified in the search query.
recursiveCategorySearch  :  boolean
Get the flag that determines if the category search will be recursive.
refinedByCategory  :  boolean  (Read Only)
The method returns true, if the search is refined by a category. The method checks, that a category ID is specified.
refinedByPrice  :  boolean  (Read Only)
Identifies if this search has been refined by price.
refinedByPromotion  :  boolean  (Read Only)
Identifies if this search has been refined by promotion.
refinedCategorySearch  :  boolean  (Read Only)
Identifies if this is a category search and is refined with further criteria, like a brand refinement or an attribute refinement.
refinementCategory  :  Category
The category used to determine possible refinements for the search. If an explicit category was set for this purpose using setRefinementCategory(Category), it is returned. Otherwise, the deepest common category of all search results will be returned.
refinements  :  ProductSearchRefinements  (Read Only)
The ProductSearchRefinements associated with this search and filtered by session currency. If an explicit category was set for this purpose using setRefinementCategory(Category), it will be used to determine the refinements. Otherwise, the refinements are determined based on the deepest common category of all products in the search result. Hint: If you want to use the same refinements for all searches, consider defining them in one category (usually root) and using setRefinementCategory(Category) to avoid unnecessary calculation of the deepest common category.
searchableImageUploadURL  :  String  (Read Only)
This method returns the URL of the endpoint where the merchants should upload their image for visual search.
searchPhraseSuggestions  :  SearchPhraseSuggestions  (Read Only)
Returns search phrase suggestions for the current search phrase. Search phrase suggestions may contain alternative search phrases as well as lists of corrected and completed search terms.
sortingRule  :  SortingRule
The sorting rule explicitly set on this model to be used to order the products in the results of this query, or null if no rule has been explicitly set. This method does not return the sorting rule that will be used implicitly based on the context of the search, such as the refinement category.
suggestedSearchPhrase  :  String  (Read Only)
The suggested search phrase with the highest accuracy provided for the current search phrase.
Deprecated:
Please use getSearchPhraseSuggestions() instead
suggestedSearchPhrases  :  List  (Read Only)
A list with up to 5 suggested search phrases provided for the current search phrase. It is possible that less than 5 suggestions or even no suggestions are returned.
Deprecated:
Please use getSearchPhraseSuggestions() instead
trackingEmptySearchesEnabled  :  boolean  (Read Only)
The method indicates if no-hits search should be tracked for predictive intelligence use.

visualSearch  :  boolean  (Read Only)
The method returns true, if this is a visual search. The method checks that a image UUID is specified.
Constructor Summary
ProductSearchModel()
Constructs a new ProductSearchModel.
Method Summary
addHitTypeRefinement(types : String...) : void
Set the only search hit types to be included from the search.
excludeHitType(types : String...) : void
Set the search hit types to be excluded from the search.
getCategory() : Category
Returns the category object for the category id specified in the query.
getCategoryID() : String
Returns the category id that was specified in the search query.
getDeepestCommonCategory() : Category
Returns the deepest common category of all products in the search result.
getEffectiveSortingRule() : SortingRule
Returns the sorting rule used to order the products in the results of this query, or null if no search has been executed yet.
getOrderableProductsOnly() : boolean
Get the flag indicating whether unorderable products should be excluded when the next call to getProducts() is made.
getPageMetaTag(id : String) : PageMetaTag
Returns the page meta tag for the specified id.
getPageMetaTags() : Array
Returns all page meta tags, defined for this instance for which content can be generated.
getPriceMax() : Number
Returns the maximum price by which the search result is refined.
getPriceMin() : Number
Returns the minimum price by which the search result is refined.
getProductID() : String
Returns the product id that was specified in the search query.
getProductIDs() : List
Returns a list of product IDs that were specified in the search query or an empty list if no product ID set.
getProducts() : Iterator
Returns all products in the search result.
getProductSearchHit(product : Product) : ProductSearchHit
Returns the underlying ProductSearchHit for a product, or null if no ProductSearchHit found for this product.
getProductSearchHits() : Iterator
Returns the product search hits in the search result.
getPromotionID() : String
Returns the promotion id that was specified in the search query or null if no promotion id set.
getPromotionIDs() : List
Returns a list of promotion id's that were specified in the search query or an empty list if no promotion id set.
getPromotionProductType() : String
Returns the promotion product type specified in the search query.
getRefinementCategory() : Category
Returns the category used to determine possible refinements for the search.
getRefinements() : ProductSearchRefinements
Returns the ProductSearchRefinements associated with this search and filtered by session currency.
getSearchableImageUploadURL() : String
This method returns the URL of the endpoint where the merchants should upload their image for visual search.
getSearchPhraseSuggestions() : SearchPhraseSuggestions
Returns search phrase suggestions for the current search phrase.
getSortingRule() : SortingRule
Returns the sorting rule explicitly set on this model to be used to order the products in the results of this query, or null if no rule has been explicitly set.
getSuggestedSearchPhrase() : String
Returns the suggested search phrase with the highest accuracy provided for the current search phrase.
getSuggestedSearchPhrases() : List
Returns a list with up to 5 suggested search phrases provided for the current search phrase.
isCategorySearch() : boolean
The method returns true, if this is a pure search for a category.
isPersonalizedSort() : boolean
The method indicates if the search result is ordered by a personalized sorting rule.
isRecursiveCategorySearch() : boolean
Get the flag that determines if the category search will be recursive.
isRefinedByCategory() : boolean
The method returns true, if the search is refined by a category.
isRefinedByPrice() : boolean
Identifies if this search has been refined by price.
isRefinedByPriceRange(priceMin : Number, priceMax : Number) : boolean
Identifies if this search has been refined by the given price range.
isRefinedByPromotion() : boolean
Identifies if this search has been refined by promotion.
isRefinedByPromotion(promotionID : String) : boolean
Identifies if this search has been refined by a given promotion.
isRefinedCategorySearch() : boolean
Identifies if this is a category search and is refined with further criteria, like a brand refinement or an attribute refinement.
isTrackingEmptySearchesEnabled() : boolean
The method indicates if no-hits search should be tracked for predictive intelligence use.
isVisualSearch() : boolean
The method returns true, if this is a visual search.
search() : SearchStatus
Execute the search based on the configured search term, category and filter conditions (price, attribute, promotion, product type) and return the execution status.
setCategoryID(categoryID : String) : void
Specifies the category id used for the search query.
setEnableTrackingEmptySearches(trackingEmptySearches : boolean) : void
Set a flag indicating whether no-hits search should be tracked for predictive intelligence use.
setOrderableProductsOnly(orderableOnly : boolean) : void
Set a flag indicating whether unorderable products should be excluded when the next call to getProducts() is made.
setPriceMax(priceMax : Number) : void
Sets the maximum price by which the search result is to be refined.
setPriceMin(priceMin : Number) : void
Sets the minimum price by which the search result is to be refined.
setProductID(productID : String) : void
Specifies the product id used for the search query.
setProductIDs(productIDs : List) : void
Specifies multiple product IDs used for the search query.
setPromotionID(promotionID : String) : void
Specifies the promotion id used for the search query.
setPromotionIDs(promotionIDs : List) : void
Specifies multiple promotion id's used for the search query.
setPromotionProductType(promotionProductType : String) : void
Specifies the promotion product type used for the search query.
setRecursiveCategorySearch(recurse : boolean) : void
Set a flag to indicate if the search in category should be recursive.
setRefinementCategory(refinementCategory : Category) : void
Sets an explicit category to be used when determining refinements.
setSearchableImageID(imageID : String) : void
An image ID can be retrieved by uploading an image with a multipart/form-data POST request to 'https://api.cquotient.com/v3/image/search/upload/{siteID}'.
setSortingCondition(attributeID : String, direction : Number) : void
Sets or removes a sorting condition for the specified attribute.
setSortingOption(option : SortingOption) : void
Sets the sorting option to be used to order the products in the results of this query.
setSortingRule(rule : SortingRule) : void
Sets the sorting rule to be used to order the products in the results of this query.
static urlForCategory(action : String, cgid : String) : URL
Constructs a URL that you can use to execute a query for a specific Category.
static urlForCategory(url : URL, cgid : String) : URL
Constructs a URL that you can use to execute a query for a specific Category.
static urlForProduct(action : String, cgid : String, pid : String) : URL
Constructs a URL that you can use to execute a query for a specific Product.
static urlForProduct(url : URL, cgid : String, pid : String) : URL
Constructs a URL that you can use to execute a query for a specific Product.
static urlForRefine(action : String, attributeID : String, value : String) : URL
Constructs a URL that you can use to execute a query for a specific attribute name-value pair.
static urlForRefine(url : URL, attributeID : String, value : String) : URL
Constructs a URL that you can use to execute a query for a specific attribute name-value pair.
urlRefineCategory(action : String, refineCategoryID : String) : URL
Constructs a URL that you can use to re-execute the query with a category refinement.
urlRefineCategory(url : URL, refineCategoryID : String) : URL
Constructs a URL that you can use to re-execute the query with a category refinement.
urlRefinePrice(action : String, min : Number, max : Number) : URL
Constructs a URL that you can use to re-execute the query with an additional price filter.
urlRefinePrice(url : URL, min : Number, max : Number) : URL
Constructs a URL that you can use to re-execute the query with an additional price filter.
urlRefinePromotion(url : URL, refinePromotionID : String) : URL
Constructs a URL that you can use to re-execute the query with a promotion refinement.
urlRefinePromotion(action : String, refinePromotionID : String) : URL
Constructs a URL that you can use to re-execute the query with a promotion refinement.
urlRelaxCategory(action : String) : URL
Constructs a URL that you can use to re-execute the query without any category refinement.
urlRelaxCategory(url : URL) : URL
Constructs a URL that you can use to re-execute the query without any category refinement.
urlRelaxPrice(action : String) : URL
Constructs a URL that you can use to re-execute the query with no price filter.
urlRelaxPrice(url : URL) : URL
Constructs a URL that you can use to would re-execute the query with no price filter.
urlRelaxPromotion(url : URL) : URL
Constructs a URL that you can use to re-execute the query without any promotion refinement.
urlRelaxPromotion(action : String) : URL
Constructs a URL that you can use to re-execute the query without any promotion refinement.
urlSortingOption(action : String, option : SortingOption) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given storefront sorting option.
urlSortingOption(url : URL, option : SortingOption) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given storefront sorting option.
urlSortingRule(action : String, rule : SortingRule) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given rule.
urlSortingRule(url : URL, rule : SortingRule) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given rule.
Constructor Detail
ProductSearchModel
public ProductSearchModel()
Constructs a new ProductSearchModel.

Method Detail
addHitTypeRefinement
addHitTypeRefinement(types : String...) : void
Set the only search hit types to be included from the search. Values accepted are the 'hit type' constants exposed in the ProductSearchHit class. Overwrites any hit type refinements set from prior calls to addHitTypeRefinement(String...) or excludeHitType(String...).
Parameters:
types - to be included.

excludeHitType
excludeHitType(types : String...) : void
Set the search hit types to be excluded from the search. Values accepted are the 'hit type' constants exposed in the ProductSearchHit class. Overwrites any hit type refinements set from prior calls to addHitTypeRefinement(String...) or excludeHitType(String...).
Parameters:
types - to be excluded.

getCategory
getCategory() : Category
Returns the category object for the category id specified in the query. If a category with that id doesn't exist or if the category is offline this method returns null.
Returns:
the category object for the category id specified in the query.

getCategoryID
getCategoryID() : String
Returns the category id that was specified in the search query.
Returns:
the category id that was specified in the search query.

getDeepestCommonCategory
getDeepestCommonCategory() : Category
Returns the deepest common category of all products in the search result. In case of an empty search result the method returns the root category.
Returns:
the deepest common category of all products in the search result of this search model or root for an empty search result.

getEffectiveSortingRule
getEffectiveSortingRule() : SortingRule
Returns the sorting rule used to order the products in the results of this query, or null if no search has been executed yet. In contrast to getSortingRule(), this method respects explicit sorting rules and sorting options and rules determined implicitly based on the refinement category, keyword sorting rule assignment, etc.
Returns:
a SortingRule or null.

getOrderableProductsOnly
getOrderableProductsOnly() : boolean
Get the flag indicating whether unorderable products should be excluded when the next call to getProducts() is made. If this value has not been previously set, then the value returned will be based on the value of the search preference.
Returns:
true if unorderable products should be excluded from product search results, false otherwise.

getPageMetaTag
getPageMetaTag(id : String) : PageMetaTag
Returns the page meta tag for the specified id.

The meta tag content is generated based on the product listing page meta tag context and rule. The rule is obtained from the current category context or inherited from the parent category, up to the root category.

Null will be returned if the meta tag is undefined on the current instance, or if no rule can be found for the current context, or if the rule resolves to an empty string.

Parameters:
id - the ID to get the page meta tag for
Returns:
page meta tag containing content generated based on rules

getPageMetaTags
getPageMetaTags() : Array
Returns all page meta tags, defined for this instance for which content can be generated.

The meta tag content is generated based on the product listing page meta tag context and rules. The rules are obtained from the current category context or inherited from the parent category, up to the root category.

Returns:
page meta tags defined for this instance, containing content generated based on rules

getPriceMax
getPriceMax() : Number
Returns the maximum price by which the search result is refined.
Returns:
the maximum price by which the search result is refined.

getPriceMin
getPriceMin() : Number
Returns the minimum price by which the search result is refined.
Returns:
the minimum price by which the search result is refined.

getProductID
getProductID() : String
Returns the product id that was specified in the search query.
Deprecated:
Please use getProductIDs() instead
Returns:
the product id that was specified in the search.

getProductIDs
getProductIDs() : List
Returns a list of product IDs that were specified in the search query or an empty list if no product ID set.
Returns:
the list of product IDs that were specified in the search query or an empty list if no product ID set.

getProducts
getProducts() : Iterator
Returns all products in the search result.
Note that products that were removed or went offline since the last index update are not included in the returned set.
Deprecated:
This method should not be used because loading Products for each result of a product search is extremely expensive performance-wise. Please use getProductSearchHits() to iterate ProductSearchHits instead.
Returns:
Products in search result

getProductSearchHit
getProductSearchHit(product : Product) : ProductSearchHit
Returns the underlying ProductSearchHit for a product, or null if no ProductSearchHit found for this product.
Parameters:
product - the product to find the underlying ProductSearchHit
Returns:
the underlying ProductSearchHit for a product, or null if no ProductSearchHit found for this product.

getProductSearchHits
getProductSearchHits() : Iterator
Returns the product search hits in the search result.
Note that method does also return search hits representing products that were removed or went offline since the last index update, i.e. you must implement appropriate checks before accessing the product related to the search hit instance (see ProductSearchHit.getProduct)
Returns:
Products hits in search result
See Also:

getPromotionID
getPromotionID() : String
Returns the promotion id that was specified in the search query or null if no promotion id set. If multiple promotion id's specified the method returns only the first id. See setPromotionIDs(List) and getPromotionIDs().
Returns:
the promotion id that was specified in the search query or null if no promotion id set.

getPromotionIDs
getPromotionIDs() : List
Returns a list of promotion id's that were specified in the search query or an empty list if no promotion id set.
Returns:
the list of promotion id's that was specified in the search query or an empty list if no promotion id set.

getPromotionProductType
getPromotionProductType() : String
Returns the promotion product type specified in the search query.
Returns:
the promotion product type that was specified in the search query.

getRefinementCategory
getRefinementCategory() : Category
Returns the category used to determine possible refinements for the search. If an explicit category was set for this purpose using setRefinementCategory(Category), it is returned. Otherwise, the deepest common category of all search results will be returned.
Returns:
the category used to determine refinements.

getRefinements
getRefinements() : ProductSearchRefinements
Returns the ProductSearchRefinements associated with this search and filtered by session currency. If an explicit category was set for this purpose using setRefinementCategory(Category), it will be used to determine the refinements. Otherwise, the refinements are determined based on the deepest common category of all products in the search result. Hint: If you want to use the same refinements for all searches, consider defining them in one category (usually root) and using setRefinementCategory(Category) to avoid unnecessary calculation of the deepest common category.
Returns:
the ProductSearchRefinements associated with this search.

getSearchableImageUploadURL
getSearchableImageUploadURL() : String
This method returns the URL of the endpoint where the merchants should upload their image for visual search.
Returns:
returns the URL where the merchants should upload their image.
Throws:
- RuntimeException

getSearchPhraseSuggestions
getSearchPhraseSuggestions() : SearchPhraseSuggestions
Returns search phrase suggestions for the current search phrase. Search phrase suggestions may contain alternative search phrases as well as lists of corrected and completed search terms.
Returns:
search phrase suggestions for the current search phrase

getSortingRule
getSortingRule() : SortingRule
Returns the sorting rule explicitly set on this model to be used to order the products in the results of this query, or null if no rule has been explicitly set. This method does not return the sorting rule that will be used implicitly based on the context of the search, such as the refinement category.
Returns:
a SortingRule or null.

getSuggestedSearchPhrase
getSuggestedSearchPhrase() : String
Returns the suggested search phrase with the highest accuracy provided for the current search phrase.
Deprecated:
Please use getSearchPhraseSuggestions() instead
Returns:
the suggested search phrase.

getSuggestedSearchPhrases
getSuggestedSearchPhrases() : List
Returns a list with up to 5 suggested search phrases provided for the current search phrase. It is possible that less than 5 suggestions or even no suggestions are returned.
Deprecated:
Please use getSearchPhraseSuggestions() instead
Returns:
a list containing the suggested search phrases.

isCategorySearch
isCategorySearch() : boolean
The method returns true, if this is a pure search for a category. The method checks, that a category ID is specified and no search phrase is specified.
Returns:
True if this is a category search

isPersonalizedSort
isPersonalizedSort() : boolean
The method indicates if the search result is ordered by a personalized sorting rule.
Returns:
true if search result is ordered by a personalized sorting rule, otherwise false.

isRecursiveCategorySearch
isRecursiveCategorySearch() : boolean
Get the flag that determines if the category search will be recursive.
Returns:
true if the category search will be recursive, false otherwise

isRefinedByCategory
isRefinedByCategory() : boolean
The method returns true, if the search is refined by a category. The method checks, that a category ID is specified.
Returns:
true, if the search is refined by a category, false otherwise.

isRefinedByPrice
isRefinedByPrice() : boolean
Identifies if this search has been refined by price.
Returns:
True if the search is refined by price, false otherwise.

isRefinedByPriceRange
isRefinedByPriceRange(priceMin : Number, priceMax : Number) : boolean
Identifies if this search has been refined by the given price range. Either range parameters may be null to represent open ranges.
Parameters:
priceMin - The lower bound of the price range.
priceMax - The upper bound of the price range.
Returns:
True if the search is refinemd on the given price range, false otherwise.

isRefinedByPromotion
isRefinedByPromotion() : boolean
Identifies if this search has been refined by promotion.
Returns:
True if the search is refined by promotion, false otherwise.

isRefinedByPromotion
isRefinedByPromotion(promotionID : String) : boolean
Identifies if this search has been refined by a given promotion.
Parameters:
promotionID - the ID of the promotion to check
Returns:
True if the search is refined by the given promotionID, false otherwise.

isRefinedCategorySearch
isRefinedCategorySearch() : boolean
Identifies if this is a category search and is refined with further criteria, like a brand refinement or an attribute refinement.
Returns:
true if this is a category search and is refined with further criteria, false otherwise.

isTrackingEmptySearchesEnabled
isTrackingEmptySearchesEnabled() : boolean
The method indicates if no-hits search should be tracked for predictive intelligence use.

Returns:
true, if no-hits search should be tracked, otherwise false.

isVisualSearch
isVisualSearch() : boolean
The method returns true, if this is a visual search. The method checks that a image UUID is specified.
Returns:
True if this is a visual search

search
search() : SearchStatus
Execute the search based on the configured search term, category and filter conditions (price, attribute, promotion, product type) and return the execution status. The execution of an empty ProductSearchModel without any search term or filter criteria will not be supported and the search status SearchStatus.EMPTY_QUERY will be returned. A usage of the internal category id 'root' as category filter is not recommended, could cause performance issues and will be potentially deprecated in a future release. A successful execution will be indicated by SearchStatus.SUCCESSFUL or SearchStatus.LIMITED. For other possible search statuses see SearchStatus. The sorted and grouped search result of a successful execution can be fetched via getProductSearchHits() and the refinement options based on the search result can be obtained via getRefinements() and SearchModel.getRefinementValues(String).
Returns:
the searchStatus object with search status code and description of search result.

setCategoryID
setCategoryID(categoryID : String) : void
Specifies the category id used for the search query.
Parameters:
categoryID - the category id for the search query.

setEnableTrackingEmptySearches
setEnableTrackingEmptySearches(trackingEmptySearches : boolean) : void
Set a flag indicating whether no-hits search should be tracked for predictive intelligence use.

Parameters:
trackingEmptySearches - true, no-hits search should be tracked, false, otherwise.

setOrderableProductsOnly
setOrderableProductsOnly(orderableOnly : boolean) : void
Set a flag indicating whether unorderable products should be excluded when the next call to getProducts() is made. This method overrides the default behavior which is controlled by the search preference.
Parameters:
orderableOnly - true if unorderable products should be excluded from product search results, false otherwise.

setPriceMax
setPriceMax(priceMax : Number) : void
Sets the maximum price by which the search result is to be refined.
Parameters:
priceMax - sets the maximum price by which the search result is to be refined.

setPriceMin
setPriceMin(priceMin : Number) : void
Sets the minimum price by which the search result is to be refined.
Parameters:
priceMin - the minimum price by which the search result is to be refined.

setProductID
setProductID(productID : String) : void
Specifies the product id used for the search query.
Deprecated:
Please use setProductIDs(List) instead
Parameters:
productID - the product id for the search query.

setProductIDs
setProductIDs(productIDs : List) : void
Specifies multiple product IDs used for the search query. The specified product IDs include, but not limited to, variant product IDs, product master IDs, variation group IDs, product set IDs, or product bundle IDs. For example, this API could be used in high-traffic pages where developers need to be able to filter quickly for only available child products of a specified master product, instead of looping through all variants of a set products and checking their availabilities. The method supports up to MAXIMUM_PRODUCT_IDS product IDs. If more than MAXIMUM_PRODUCT_IDS products IDs are passed, the method throws an IllegalArgumentException.
Parameters:
productIDs - the product IDs for the search query.
Throws:
IllegalArgumentException - if more than MAXIMUM_PRODUCT_IDS product IDs used

setPromotionID
setPromotionID(promotionID : String) : void
Specifies the promotion id used for the search query.
Parameters:
promotionID - the promotion id for the search query.

setPromotionIDs
setPromotionIDs(promotionIDs : List) : void
Specifies multiple promotion id's used for the search query. The method supports up to 30 promotion id's. If more than 30 promotion id's used the method throws an IllegalArgumentException.
Parameters:
promotionIDs - the promotion ids for the search query.
Throws:
IllegalArgumentException - if more than 30 promotion id's used

setPromotionProductType
setPromotionProductType(promotionProductType : String) : void
Specifies the promotion product type used for the search query. This value is only relevant for searches by promotion ID.
Parameters:
promotionProductType - The type of product to filter by when searching by promotion ID. Allowed values are PROMOTION_PRODUCT_TYPE_ALL, PROMOTION_PRODUCT_TYPE_BONUS, PROMOTION_PRODUCT_TYPE_QUALIFYING, and PROMOTION_PRODUCT_TYPE_DISCOUNTED. If null is passed, or an invalid value is passed, the search will use PROMOTION_PRODUCT_TYPE_ALL.

setRecursiveCategorySearch
setRecursiveCategorySearch(recurse : boolean) : void
Set a flag to indicate if the search in category should be recursive.
Parameters:
recurse - recurse the category in the search

setRefinementCategory
setRefinementCategory(refinementCategory : Category) : void
Sets an explicit category to be used when determining refinements. If this is not done, they will be determined based on the deepest common category of all search results. The explicit category must be in the site's storefront catalog, otherwise the method fails with an IllegalArgumentException.
Parameters:
refinementCategory - the category used to determine the applicable refinements.
Throws:
IllegalArgumentException - if the refinement category does not reside in the storefront catalog

setSearchableImageID
setSearchableImageID(imageID : String) : void
An image ID can be retrieved by uploading an image with a multipart/form-data POST request to 'https://api.cquotient.com/v3/image/search/upload/{siteID}'. This method sets product IDs retrieved from the image ID to the ProductSearchModel. If using setProductIDs(List) in addition to this method, the ProductSearchModel will take the intersection of these sets of product IDs. If the image ID provided is invalid or expired, product IDs will not be set onto the product search model.
Parameters:
imageID - the image ID for the visual search query.
Throws:
RuntimeException - if product IDs for the provided image could not be set.

setSortingCondition
setSortingCondition(attributeID : String, direction : Number) : void
Sets or removes a sorting condition for the specified attribute. Specify either SORT_DIRECTION_ASCENDING or SORT_DIRECTION_DESCENDING to set a sorting condition. Specify SORT_DIRECTION_NONE to remove a sorting condition from the attribute.
Deprecated:
This method is subject to removal. Use setSortingRule(SortingRule) instead.
Parameters:
attributeID - the attribute ID
direction - SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING or SORT_DIRECTION_NONE

setSortingOption
setSortingOption(option : SortingOption) : void
Sets the sorting option to be used to order the products in the results of this query. If a sorting rule is also set, the sorting option is ignored.
Parameters:
option - the SortingOption to use to sort the products

setSortingRule
setSortingRule(rule : SortingRule) : void
Sets the sorting rule to be used to order the products in the results of this query. Setting the rule in this way overrides the default behavior of choosing the sorting rule based on the context of the search, such as the refinement category.
Parameters:
rule - the SortingRule to use to sort the products

urlForCategory
static urlForCategory(action : String, cgid : String) : URL
Constructs a URL that you can use to execute a query for a specific Category. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - pipeline action, e.g. 'Search-Show'.
cgid - the category ID.
Returns:
the new URL.

urlForCategory
static urlForCategory(url : URL, cgid : String) : URL
Constructs a URL that you can use to execute a query for a specific Category. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the URL to use to generate the new URL.
cgid - the category ID.
Returns:
the new URL.

urlForProduct
static urlForProduct(action : String, cgid : String, pid : String) : URL
Constructs a URL that you can use to execute a query for a specific Product. The passed action is used to build an initial url. All search specific attributes are appended. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - pipeline action, e.g. 'Search-Show'.
cgid - the category id or null if product is not in category context.
pid - the product id.
Returns:
the new URL.

urlForProduct
static urlForProduct(url : URL, cgid : String, pid : String) : URL
Constructs a URL that you can use to execute a query for a specific Product. The passed url can be either a full url or just the name for a pipeline. In the later case a relative URL is created.
Parameters:
url - the URL to use to generate the new URL.
cgid - the category id or null if product is not in category context.
pid - the product id.
Returns:
the new URL.

urlForRefine
static urlForRefine(action : String, attributeID : String, value : String) : URL
Constructs a URL that you can use to execute a query for a specific attribute name-value pair. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - pipeline action, e.g. 'Search-Show'.
attributeID - the attribute ID for the refinement.
value - the attribute value for the refinement.
Returns:
the new URL.

urlForRefine
static urlForRefine(url : URL, attributeID : String, value : String) : URL
Constructs a URL that you can use to execute a query for a specific attribute name-value pair. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the URL to use to generate the new URL.
attributeID - the attribute ID for the refinement.
value - the attribute value for the refinement.
Returns:
the new URL.

urlRefineCategory
urlRefineCategory(action : String, refineCategoryID : String) : URL
Constructs a URL that you can use to re-execute the query with a category refinement. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'
refineCategoryID - the ID of the category.
Returns:
the new URL.

urlRefineCategory
urlRefineCategory(url : URL, refineCategoryID : String) : URL
Constructs a URL that you can use to re-execute the query with a category refinement. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the existing URL to use to create the new URL.
refineCategoryID - the ID of the category.
Returns:
the new URL.

urlRefinePrice
urlRefinePrice(action : String, min : Number, max : Number) : URL
Constructs a URL that you can use to re-execute the query with an additional price filter. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'.
min - the minimum price.
max - the maximum price.
Returns:
the new URL.

urlRefinePrice
urlRefinePrice(url : URL, min : Number, max : Number) : URL
Constructs a URL that you can use to re-execute the query with an additional price filter. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the URL to use to generate the new URL.
min - the minimum price.
max - the maximum price.
Returns:
the new URL.

urlRefinePromotion
urlRefinePromotion(url : URL, refinePromotionID : String) : URL
Constructs a URL that you can use to re-execute the query with a promotion refinement. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the existing URL to use to create the new URL.
refinePromotionID - the ID of the promotion.
Returns:
the new URL.

urlRefinePromotion
urlRefinePromotion(action : String, refinePromotionID : String) : URL
Constructs a URL that you can use to re-execute the query with a promotion refinement. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'
refinePromotionID - the ID of the promotion.
Returns:
the new URL.

urlRelaxCategory
urlRelaxCategory(action : String) : URL
Constructs a URL that you can use to re-execute the query without any category refinement. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'.
Returns:
the new URL.

urlRelaxCategory
urlRelaxCategory(url : URL) : URL
Constructs a URL that you can use to re-execute the query without any category refinement. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the existing URL to use to create the new URL.
Returns:
the new URL.

urlRelaxPrice
urlRelaxPrice(action : String) : URL
Constructs a URL that you can use to re-execute the query with no price filter. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'
Returns:
the new URL.

urlRelaxPrice
urlRelaxPrice(url : URL) : URL
Constructs a URL that you can use to would re-execute the query with no price filter. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the existing URL to use to create the new URL.
Returns:
the new URL.

urlRelaxPromotion
urlRelaxPromotion(url : URL) : URL
Constructs a URL that you can use to re-execute the query without any promotion refinement. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the existing URL to use to create the new URL.
Returns:
the new URL.

urlRelaxPromotion
urlRelaxPromotion(action : String) : URL
Constructs a URL that you can use to re-execute the query without any promotion refinement. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'.
Returns:
the new URL.

urlSortingOption
urlSortingOption(action : String, option : SortingOption) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given storefront sorting option. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'.
option - sorting option
Returns:
the new URL.

urlSortingOption
urlSortingOption(url : URL, option : SortingOption) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given storefront sorting option. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the existing URL to use to create the new URL.
option - sorting option
Returns:
the new URL.

urlSortingRule
urlSortingRule(action : String, rule : SortingRule) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given rule. The generated URL will be an absolute URL which uses the protocol of the current request.
Parameters:
action - the pipeline action, e.g. 'Search-Show'.
rule - sorting rule
Returns:
the new URL.

urlSortingRule
urlSortingRule(url : URL, rule : SortingRule) : URL
Constructs a URL that you can use to re-execute the query but sort the results by the given rule. The search specific parameters are appended to the provided URL. The URL is typically generated with one of the URLUtils methods.
Parameters:
url - the existing URL to use to create the new URL.
rule - sorting rule
Returns:
the new URL.