dw.catalog
Class ProductSearchHit
dw.catalog.ProductSearchHit
ProductSearchHit is the result of a executed search query and wraps the actual product found by the search.
The method getRepresentedProducts() returns the actual products that is conforming the query and is represented by the search hit.
Depending on the hit typ, getRepresentedProducts() returns:
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation product
- HIT_TYPE_PRODUCT_SET -> a product part of set
- HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle
- HIT_TYPE_VARIATION_GROUP -> a variation product
- HIT_TYPE_SIMPLE
- HIT_TYPE_PRODUCT_MASTER
- HIT_TYPE_PRODUCT_SET
- HIT_TYPE_PRODUCT_BUNDLE
- HIT_TYPE_VARIATION_GROUP
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation master product
- HIT_TYPE_PRODUCT_SET -> a product set
- HIT_TYPE_PRODUCT_BUNDLE -> a product bundle
- HIT_TYPE_VARIATION_GROUP ->a variation group
- V1 - color: red, size: small
- V2 - color: red, size: large
- V3 - color: blue, size: small
- V4 - color: blue, size: large
- V5 - color: yellow, size: small
- V6 - color: yellow, size: large
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 currently returns 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 currently returns 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 currently returns 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 product that is actually hit by the search and has the highest
sort rank according to the sorting conditions used for the search query.
firstRepresentedProductID
:
String
(Read Only)
The ID of the product that is actually hit by the search and has the highest
sort rank according to the sorting conditions used for the search query.
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 product that is actually hit by the search and has the lowest
sort rank according to the sorting conditions used for the search query.
lastRepresentedProductID
:
String
(Read Only)
The ID of the product that is actually hit by the search and has the lowest
sort rank according to the sorting conditions used for the search query.
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.
maxPricePerUnit
:
Money
(Read Only)
The maximum price per unit 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.
minPricePerUnit
:
Money
(Read Only)
The minimum price per unit 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 presentation product of this ProductSearchHit corresponding to the ProductSearchHit type.
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation master product
- HIT_TYPE_PRODUCT_SET -> a product set
- HIT_TYPE_PRODUCT_BUNDLE -> a product bundle
- HIT_TYPE_VARIATION_GROUP ->a variation group
productID
:
String
(Read Only)
The ID of the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type.
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation master product
- HIT_TYPE_PRODUCT_SET -> a product set
- HIT_TYPE_PRODUCT_BUNDLE -> a product bundle
- HIT_TYPE_VARIATION_GROUP ->a variation group
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 currently returns 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)
The method returns the actual ID of the product that is conforming the query and is represented by the search hit.
Depending on the hit typ, it returns the ID of:
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation product
- HIT_TYPE_PRODUCT_SET -> a product part of set
- HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle
- HIT_TYPE_VARIATION_GROUP ->a variation product
representedProducts
:
List
(Read Only)
The method returns the actual product that is conforming the query and is represented by the search hit.
Depending on the hit typ, getRepresentedProducts() returns:
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation product
- HIT_TYPE_PRODUCT_SET -> a product part of set
- HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle
- HIT_TYPE_VARIATION_GROUP ->a variation product
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
getFirstRepresentedProduct()
:
Product
Returns the product that is actually hit by the search and has the highest sort rank according to the sorting conditions used for the search query.
getFirstRepresentedProductID()
:
String
Returns the ID of the product that is actually hit by the search and has the highest sort rank according to the sorting conditions used for the search query.
getHitType()
:
String
Returns the type of the product wrapped by this search hit.
getLastRepresentedProduct()
:
Product
Returns the product that is actually hit by the search and has the lowest sort rank according to the sorting conditions used for the search query.
getLastRepresentedProductID()
:
String
Returns the ID of the product that is actually hit by the search and has the lowest sort rank according to the sorting conditions used for the search query.
getMaxPrice()
:
Money
Returns the maximum price of all products represented by the product hit.
getMaxPricePerUnit()
:
Money
Returns the maximum price per unit of all products represented by the product hit.
getMinPrice()
:
Money
Returns the minimum price of all products represented by the product hit.
getMinPricePerUnit()
:
Money
Returns the minimum price per unit of all products represented by the product hit.
getProduct()
:
Product
Returns the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type.
getProductID()
:
String
Returns the ID of the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type.
getRepresentedProductIDs()
:
List
The method returns the actual ID of the product that is conforming the query and is represented by the search hit.
getRepresentedProducts()
:
List
The method returns the actual product that is conforming the query and is represented by the search hit.
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
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Method Detail
getFirstRepresentedProduct
getFirstRepresentedProduct()
:
Product
Returns the product that is actually hit by the search and has the highest
sort rank according to the sorting conditions used for the search query.
Returns:
the first product that is actually hit by the search
getFirstRepresentedProductID
getFirstRepresentedProductID()
:
String
Returns the ID of the product that is actually hit by the search and has the highest
sort rank according to the sorting conditions used for the search query.
Returns:
the ID of the first product that is actually hit by the search
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 product that is actually hit by the search and has the lowest
sort rank according to the sorting conditions used for the search query.
Returns:
the last product that is actually hit by the search
getLastRepresentedProductID
getLastRepresentedProductID()
:
String
Returns the ID of the product that is actually hit by the search and has the lowest
sort rank according to the sorting conditions used for the search query.
Returns:
the ID of the last product that is actually hit by the search
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.
getMaxPricePerUnit
getMaxPricePerUnit()
:
Money
Returns the maximum price per unit 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 per unit 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.
getMinPricePerUnit
getMinPricePerUnit()
:
Money
Returns the minimum price per unit 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 per unit of all products represented by the product hit.
getProduct
getProduct()
:
Product
Returns the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type.
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation master product
- HIT_TYPE_PRODUCT_SET -> a product set
- HIT_TYPE_PRODUCT_BUNDLE -> a product bundle
- HIT_TYPE_VARIATION_GROUP ->a variation group
Returns:
the presentation product of this ProductSearchHit, which is possibly a representative of other related products actually hit by the search.
See Also:
getProductID
getProductID()
:
String
Returns the ID of the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type.
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation master product
- HIT_TYPE_PRODUCT_SET -> a product set
- HIT_TYPE_PRODUCT_BUNDLE -> a product bundle
- HIT_TYPE_VARIATION_GROUP ->a variation group
Returns:
the ID of the presentation product of this ProductSearchHit, that possibly represents a set of related products actually hit by the search.
See Also:
getRepresentedProductIDs
getRepresentedProductIDs()
:
List
The method returns the actual ID of the product that is conforming the query and is represented by the search hit.
Depending on the hit typ, it returns the ID of:
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation product
- HIT_TYPE_PRODUCT_SET -> a product part of set
- HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle
- HIT_TYPE_VARIATION_GROUP ->a variation product
Returns:
a sorted list of products represented by the wrapped product.
getRepresentedProducts
getRepresentedProducts()
:
List
The method returns the actual product that is conforming the query and is represented by the search hit.
Depending on the hit typ, getRepresentedProducts() returns:
- HIT_TYPE_SIMPLE -> a simple product
- HIT_TYPE_PRODUCT_MASTER -> a variation product
- HIT_TYPE_PRODUCT_SET -> a product part of set
- HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle
- HIT_TYPE_VARIATION_GROUP ->a variation product
Returns:
a sorted list of products represented by the wrapped product.
getRepresentedVariationValues
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.