Class ProductAllSkusSolrDocumentContributor
- java.lang.Object
-
- com.broadleafcommerce.search.index.catalog.solr.document.ProductAllSkusSolrDocumentContributor
-
- All Implemented Interfaces:
com.broadleafcommerce.search.index.core.document.DocumentBuilderContributor<org.apache.solr.common.SolrInputDocument>
public class ProductAllSkusSolrDocumentContributor extends Object implements com.broadleafcommerce.search.index.core.document.DocumentBuilderContributor<org.apache.solr.common.SolrInputDocument>
Component that collects all of the SKUs on a Product and stores them in a single, multi-valued Solr field to allow for easy retrieval of Solr documents, especially when we don't have the Product's context ID or other identifier.- Author:
- Kelly Tisdell (ktisdell)
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
ADDITIONAL_SKUS_JSON_PATH
protected static String
PRIMARY_SKU_JSON_PATH
-
Constructor Summary
Constructors Constructor Description ProductAllSkusSolrDocumentContributor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
void
contributeInternal(com.broadleafcommerce.search.api.domain.Indexable<?> indexable, org.apache.solr.common.SolrInputDocument document, com.jayway.jsonpath.DocumentContext jsonContext, List<com.broadleafcommerce.search.api.domain.FieldDefinition> searchFields)
protected Set<String>
determineSkuReferences(com.broadleafcommerce.search.catalog.core.domain.Product product, com.jayway.jsonpath.DocumentContext jsonContext)
Returns aSet
of SKUs from the Product.
-
-
-
Field Detail
-
PRIMARY_SKU_JSON_PATH
protected static final String PRIMARY_SKU_JSON_PATH
- See Also:
- Constant Field Values
-
ADDITIONAL_SKUS_JSON_PATH
protected static final String ADDITIONAL_SKUS_JSON_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
contributeInternal
public void contributeInternal(com.broadleafcommerce.search.api.domain.Indexable<?> indexable, org.apache.solr.common.SolrInputDocument document, com.jayway.jsonpath.DocumentContext jsonContext, List<com.broadleafcommerce.search.api.domain.FieldDefinition> searchFields) throws com.broadleafcommerce.search.api.SearchIndexException
- Specified by:
contributeInternal
in interfacecom.broadleafcommerce.search.index.core.document.DocumentBuilderContributor<org.apache.solr.common.SolrInputDocument>
- Throws:
com.broadleafcommerce.search.api.SearchIndexException
-
canHandle
public boolean canHandle(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
- Specified by:
canHandle
in interfacecom.broadleafcommerce.search.index.core.document.DocumentBuilderContributor<org.apache.solr.common.SolrInputDocument>
-
determineSkuReferences
protected Set<String> determineSkuReferences(com.broadleafcommerce.search.catalog.core.domain.Product product, com.jayway.jsonpath.DocumentContext jsonContext)
Returns aSet
of SKUs from the Product. The product has a primary SKU as well as optional, additional SKUs on the Variants.- Parameters:
product
- the product containing the metadatajsonContext
- the JSON Document Context which is used to extract SKUs- Returns:
-
-