dw.catalog
Class ProductSearchHit
Object
dw.catalog.ProductSearchHit
Represents a product search result item returned by the Search pipelet.
An instance of ProductSearchHit is a wrapper around the actual product returned by the search. The wrapped product can be accessed by method getProduct(). An instance of ProductSearchHit contains a hit type that can be accessed by method getHitType(). A hit type can be refined against and encapsulates the wrapped product type of the hit.

For special product types, the wrapped product can be the representative of other related products actually hit by the search. A variation master or variation group returned by the search represents a collection of hit variants. A product set returned by the search represents a collection of hit set-products. A bundle returned by the search represents a collection of hit bundled-products. If the product wrapped by this ProductSearchHit is the representative of other products, method getRepresentedProducts() can be used to access all these products.

Constants
HIT_TYPE_PRODUCT_BUNDLE  :  String = "bundle"
Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with product bundles.
HIT_TYPE_PRODUCT_MASTER  :  String = "master"
Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with master products.
HIT_TYPE_PRODUCT_SET  :  String = "set"
Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with product sets.
HIT_TYPE_SIMPLE  :  String = "product"
Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with single, non-complex products, including product variants that are assigned to a category and are returned as the presentation product.
HIT_TYPE_SLICING_GROUP  :  String = "slicing_group"
Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with slicing groups.
Deprecated:
Please use HIT_TYPE_VARIATION_GROUP instead.
HIT_TYPE_VARIATION_GROUP  :  String = "variation_group"
Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with variation groups.
Properties
allPromotionIDs  :  List  (Read Only)
Return the IDs of all searchable promotions for which at least one of the represented products of this search hit relates to the promotion, either as qualifying, discount, or bonus product. This may be used as a better performing alternative to PromotionPlan.getProductPromotions(Product) in some special cases. However be warned: this method has no additional checks and returns currently all id's which are known at indexing time. Custom code should generally filter and sort the promotions returned by this method according to PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile.
bonusPromotionIDs  :  List  (Read Only)
Return the IDs of all searchable promotions for which at least one of the represented products of this search hit is a bonus product. This may be used as a better performing alternative to PromotionPlan.getProductPromotions(Product) in some special cases. However be warned: this method has no additional checks and returns currently all id's which are known at indexing time. Custom code should generally filter and sort the promotions returned by this method according to PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile.
discountedPromotionIDs  :  List  (Read Only)
Return the IDs of all searchable promotions for which at least one of the represented products of this search hit satisfy the discounted product rule. This may be used as a better performing alternative to PromotionPlan.getProductPromotionsForDiscountedProduct(Product) in some special cases. However be warned: this method has no additional checks and returns currently all id's which are known at indexing time. Custom code should generally filter and sort the promotions returned by this method according to PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile.
firstRepresentedProduct  :  Product  (Read Only)
The first product represented by the product wrapped by the search hit.
firstRepresentedProductID  :  String  (Read Only)
The first product ID represented by the product wrapped by the search hit.
hitType  :  String  (Read Only)
The type of the product wrapped by this search hit. The product type returned will be one of the hit types:
lastRepresentedProduct  :  Product  (Read Only)
The last product represented by the product wrapped by the search hit.
lastRepresentedProductID  :  String  (Read Only)
The last product ID represented by the product wrapped by the search hit.
maxPrice  :  Money  (Read Only)
The maximum price of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the maximum. The method returns N/A in case no price information can be found.

Note: The method uses price information of the search index and therefore might return different prices than the ProductPriceModel.

minPrice  :  Money  (Read Only)
The minimum price of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the minimum. The method returns N/A in case no price information can be found.

Note: The method uses price information of the search index and therefore might return different prices than the ProductPriceModel.

priceRange  :  boolean  (Read Only)
Convenience method to check whether this ProductSearchHit represents multiple products (see getRepresentedProducts()) that have different prices.
product  :  Product  (Read Only)
The product wrapped by this ProductSearchHit. For special product types, the wrapped product can be the representative of other related products actually hit by the search. A variation master returned by the search represents a collection of hit variants. A product set returned by the search represents a collection of hit set-products. A bundle returned by the search represents a collection of hit bundled-products. In this case call getRepresentedProducts() to get a list of the represented products.
productID  :  String  (Read Only)
The product ID of this ProductSearchHit. For special product types, the ID can be the representative of other related products actually hit by the search. A variation master ID returned by the search represents a collection of hit variants. A product set ID returned by the search represents a collection of hit set-products. A bundle ID returned by the search represents a collection of hit bundled-products. In this case call getRepresentedProductIDs() to get a list of the represented product IDs.
qualifyingPromotionIDs  :  List  (Read Only)
Return the IDs of all searchable promotions for which at least one of the represented products of this search hit satisfies the qualifying product rule. This may be used as a better performing alternative to PromotionPlan.getProductPromotionsForQualifyingProduct(Product) in some special cases. However be warned: this method has no additional checks and returns currently all id's which are known at indexing time. Custom code should generally filter and sort the promotions returned by this method according to PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile.
representedProductIDs  :  List  (Read Only)
In case the product that is wrapped by this ProductSearchHit (see getProduct()) is a variation or a variation master or a product set, this ProductSearchHit can represent multiple products.

* The following specific rules apply:

  • If the wrapped product is a variation master, the method returns all variant IDs of this master that satisfy the search query.
  • If the wrapped product is a variation group, the method returns all variant IDs of this variation group that satisfy the search query.
  • If the wrapped product is a variant representing other variants (due to variation slicing), the method returns this variant ID and all represented variant IDs that satisfy the search query.
  • If the wrapped product is a product set, the method returns all set products IDs that satisfy the search query.
  • If the wrapped product is a product bundle, the method returns all bundled product IDs that satisfy the search query.
  • If the wrapped product is a simple product, the method returns this product ID

If the method returns multiple product IDs, the ID of the product with the highest sort rank is returned first, and the ID of the product with the lowest sort rank is returned last. The product sort rank depends in the sorting conditions used for the search query.

representedProducts  :  List  (Read Only)
In case the product that is wrapped by this ProductSearchHit (see getProduct()) is a variation or a variation master or a product set, this ProductSearchHit can represent multiple products.

* The following specific rules apply:

  • If the wrapped product is a variation master, the method returns all variants of this master that satisfy the search query.
  • If the wrapped product is a variation group, the method returns all variants of this variation group that satisfy the search query.
  • If the wrapped product is a variant representing other variants (due to variation slicing), the method returns this variant and all represented variants that satisfy the search query.
  • If the wrapped product is a product set, the method returns all set products that satisfy the search query.
  • If the wrapped product is a product bundle, the method returns all bundled products that satisfy the search query.
  • If the wrapped product is a simple product, the method returns this product

If the method returns multiple products, the product with the highest sort rank is returned first, and the product with the lowest sort rank is returned last. The product sort rank depends in the sorting conditions used for the search query.

Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
getFirstRepresentedProduct() : Product
Returns the first product represented by the product wrapped by the search hit.
getFirstRepresentedProductID() : String
Returns the first product ID represented by the product wrapped by the search hit.
getHitType() : String
Returns the type of the product wrapped by this search hit.
getLastRepresentedProduct() : Product
Returns the last product represented by the product wrapped by the search hit.
getLastRepresentedProductID() : String
Returns the last product ID represented by the product wrapped by the search hit.
getMaxPrice() : Money
Returns the maximum price of all products represented by the product hit.
getMinPrice() : Money
Returns the minimum price of all products represented by the product hit.
getProduct() : Product
Returns the product wrapped by this ProductSearchHit.
getProductID() : String
Returns the product ID of this ProductSearchHit.
getRepresentedProductIDs() : List
In case the product that is wrapped by this ProductSearchHit (see getProduct()) is a variation or a variation master or a product set, this ProductSearchHit can represent multiple products.
getRepresentedProducts() : List
In case the product that is wrapped by this ProductSearchHit (see getProduct()) is a variation or a variation master or a product set, this ProductSearchHit can represent multiple products.
getRepresentedVariationValues(va : Object) : List
This method is only applicable if this ProductSearchHit represents a product variation (see getRepresentedProducts).
isPriceRange() : boolean
Convenience method to check whether this ProductSearchHit represents multiple products (see getRepresentedProducts()) that have different prices.
Methods inherited from class Object
Method Detail
getFirstRepresentedProduct
getFirstRepresentedProduct() : Product
Returns the first product represented by the product wrapped by the search hit.
Returns:
The first product represented by the wrapped product.

getFirstRepresentedProductID
getFirstRepresentedProductID() : String
Returns the first product ID represented by the product wrapped by the search hit.
Returns:
The first product ID represented by the wrapped product.

getHitType
getHitType() : String
Returns the type of the product wrapped by this search hit. The product type returned will be one of the hit types:
Returns:
search hit type

getLastRepresentedProduct
getLastRepresentedProduct() : Product
Returns the last product represented by the product wrapped by the search hit.
Returns:
The last product represented by the wrapped product.

getLastRepresentedProductID
getLastRepresentedProductID() : String
Returns the last product ID represented by the product wrapped by the search hit.
Returns:
The last product ID represented by the wrapped product.

getMaxPrice
getMaxPrice() : Money
Returns the maximum price of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the maximum. The method returns N/A in case no price information can be found.

Note: The method uses price information of the search index and therefore might return different prices than the ProductPriceModel.

Returns:
The maximum price of all products represented by the product hit.

getMinPrice
getMinPrice() : Money
Returns the minimum price of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the minimum. The method returns N/A in case no price information can be found.

Note: The method uses price information of the search index and therefore might return different prices than the ProductPriceModel.

Returns:
The minimum price of all products represented by the product hit.

getProduct
getProduct() : Product
Returns the product wrapped by this ProductSearchHit. For special product types, the wrapped product can be the representative of other related products actually hit by the search. A variation master returned by the search represents a collection of hit variants. A product set returned by the search represents a collection of hit set-products. A bundle returned by the search represents a collection of hit bundled-products. In this case call getRepresentedProducts() to get a list of the represented products.
Returns:
the Product wrapped by this ProductSearchHit, which is possible a representative of other related products actually hit by the search.

getProductID
getProductID() : String
Returns the product ID of this ProductSearchHit. For special product types, the ID can be the representative of other related products actually hit by the search. A variation master ID returned by the search represents a collection of hit variants. A product set ID returned by the search represents a collection of hit set-products. A bundle ID returned by the search represents a collection of hit bundled-products. In this case call getRepresentedProductIDs() to get a list of the represented product IDs.
Returns:
the Product ID of this ProductSearchHit, that possibly represents a set of related products actually hit by the search.

getRepresentedProductIDs
getRepresentedProductIDs() : List
In case the product that is wrapped by this ProductSearchHit (see getProduct()) is a variation or a variation master or a product set, this ProductSearchHit can represent multiple products.

* The following specific rules apply:

  • If the wrapped product is a variation master, the method returns all variant IDs of this master that satisfy the search query.
  • If the wrapped product is a variation group, the method returns all variant IDs of this variation group that satisfy the search query.
  • If the wrapped product is a variant representing other variants (due to variation slicing), the method returns this variant ID and all represented variant IDs that satisfy the search query.
  • If the wrapped product is a product set, the method returns all set products IDs that satisfy the search query.
  • If the wrapped product is a product bundle, the method returns all bundled product IDs that satisfy the search query.
  • If the wrapped product is a simple product, the method returns this product ID

If the method returns multiple product IDs, the ID of the product with the highest sort rank is returned first, and the ID of the product with the lowest sort rank is returned last. The product sort rank depends in the sorting conditions used for the search query.

Returns:
a sorted list of product IDs represented by the wrapped product.

getRepresentedProducts
getRepresentedProducts() : List
In case the product that is wrapped by this ProductSearchHit (see getProduct()) is a variation or a variation master or a product set, this ProductSearchHit can represent multiple products.

* The following specific rules apply:

  • If the wrapped product is a variation master, the method returns all variants of this master that satisfy the search query.
  • If the wrapped product is a variation group, the method returns all variants of this variation group that satisfy the search query.
  • If the wrapped product is a variant representing other variants (due to variation slicing), the method returns this variant and all represented variants that satisfy the search query.
  • If the wrapped product is a product set, the method returns all set products that satisfy the search query.
  • If the wrapped product is a product bundle, the method returns all bundled products that satisfy the search query.
  • If the wrapped product is a simple product, the method returns this product

If the method returns multiple products, the product with the highest sort rank is returned first, and the product with the lowest sort rank is returned last. The product sort rank depends in the sorting conditions used for the search query.

Returns:
a sorted list of products represented by the wrapped product.

getRepresentedVariationValues
getRepresentedVariationValues(va : Object) : List
This method is only applicable if this ProductSearchHit represents a product variation (see getRepresentedProducts). It returns the distinct value set for the specified variation attribute for all variants represented by this ProductSearchHit. The values are returned in the same order as they are defined for the variation.

This method will accept a ProductVariationAttribute parameter or a String which is the ID of a variation attribute. If any other object type is passed, or null is passed, an exception will be thrown. If this ProductSearchHit does not represent a product variation, or the passed variation attribute is not associated with this product, the method returns an empty list.

Parameters:
va - the product variation attribute, specified as either a ProductVariationAttribute or a String which is the ID of a variation attribute associated with this product.
Returns:
A list containing all distinct ProductVariationAttributeValues.

isPriceRange
isPriceRange() : boolean
Convenience method to check whether this ProductSearchHit represents multiple products (see getRepresentedProducts()) that have different prices.
Returns:
True if the represented products form a price range False otherwise.