Class ProductSingleIndexRequestHandler


  • public class ProductSingleIndexRequestHandler
    extends AbstractProductSingleIndexRequestHandler
    Listens for single index requests originating from changes to Products and sends them to be updated in the index. This implementation only looks at requests originating from Products. Requests originating from updates to entities/documents related to products (e.g. Categories, Assets, etc) are handled in AncillaryProductSingleIndexRequestHandler.

    The default flow of this handler is as follows:

    1. Delete all products from the index matching the contextId of the product in the single index request.
    2. Read all products from catalog matching the contextId of the single index request.
    3. Reindex all products returned from the previous step.
    Step 1 is necessary to ensure stale documents do not linger in the index, and delete works because, when we perform step 2, we always retrieve all products from all catalogs matching the contextId of the single index request.

    The reason for reading all products is due to catalog overrides and sandbox documents. In order to get a complete view of the catalog and sandbox hierarchy, we must read all products. A single persistence event can potentially affect all products in the hierarchy, thus requires a reindex of all products matching a particular contextId.

    • Field Detail

      • supportedSimpleTypeNames

        protected static final String[] supportedSimpleTypeNames
    • Constructor Detail

      • ProductSingleIndexRequestHandler

        public ProductSingleIndexRequestHandler​(CatalogService catalogService,
                                                com.broadleafcommerce.search.index.core.service.ReindexDelegationService reindexDelegationService,
                                                com.broadleafcommerce.search.index.core.service.ReindexService reindexService,
                                                com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    • Method Detail

      • hook

        @StreamListener("singleIndexRequestInputProduct")
        public void hook​(String singleIndexRequest)
        Specified by:
        hook in class com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
      • processSingleIndexRequest

        public void processSingleIndexRequest​(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
        Specified by:
        processSingleIndexRequest in class com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
      • getSupportedSimpleTypeNames

        public String[] getSupportedSimpleTypeNames()
        Specified by:
        getSupportedSimpleTypeNames in class com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler