Class 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)
    • Constructor Detail

      • ProductAllSkusSolrDocumentContributor

        public ProductAllSkusSolrDocumentContributor()
    • 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 interface com.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 interface com.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 a Set 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 metadata
        jsonContext - the JSON Document Context which is used to extract SKUs
        Returns: