Class SolrProductIndexWorker
- java.lang.Object
-
- com.broadleafcommerce.search.index.core.worker.AbstractWorker<com.broadleafcommerce.search.index.core.queue.BatchIdHolder<String>>
-
- com.broadleafcommerce.search.index.catalog.solr.worker.SolrProductIndexWorker
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SolrProductIndexWorker(@NonNull com.broadleafcommerce.search.index.core.ProcessStateService processStateService, @NonNull Semaphore semaphore, @NonNull com.broadleafcommerce.search.api.type.IndexableType type, @NonNull com.broadleafcommerce.search.index.core.queue.ReindexQueue<com.broadleafcommerce.search.index.core.queue.BatchIdHolder<String>> queue, @NonNull com.broadleafcommerce.search.index.catalog.service.CatalogService catalogService, @NonNull com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument> documentBuilder, @NonNull com.broadleafcommerce.search.provider.solr.SolrIndexProvider solrIndexProvider, @NonNull com.broadleafcommerce.search.provider.solr.SolrCollectionResolver collectionResolver, com.broadleafcommerce.common.extension.data.DataRouteSupporting searchSource, long waitTime, int maxTries)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<com.broadleafcommerce.search.catalog.core.domain.Product>
addProductsToBeOmitted(List<com.broadleafcommerce.search.catalog.core.domain.Product> products, Set<String> omittedCatalogs)
Given a set of omitted catalogs, returns the products that should be omitted.protected Set<String>
collectCatalogsWithOmissions(List<com.broadleafcommerce.search.catalog.core.domain.Product> products)
Retrieve a set of catalogs with omissions.protected int
executeInternal(com.broadleafcommerce.search.index.core.queue.BatchIdHolder<String> queueEntry)
protected void
filterOmissions(Collection<List<com.broadleafcommerce.search.catalog.core.domain.Product>> productsById)
Filters out any products that haveomissions
.protected com.broadleafcommerce.search.index.catalog.service.CatalogService
getCatalogService()
protected com.broadleafcommerce.search.provider.solr.SolrCollectionResolver
getCollectionResolver()
protected com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument>
getDocumentBuilder()
protected com.broadleafcommerce.search.provider.solr.SolrIndexProvider
getSolrIndexProvider()
protected boolean
shouldBeOmitted(com.broadleafcommerce.search.catalog.core.domain.Product product, String omittedCatalog)
-
-
-
Constructor Detail
-
SolrProductIndexWorker
protected SolrProductIndexWorker(@NonNull @NonNull com.broadleafcommerce.search.index.core.ProcessStateService processStateService, @NonNull @NonNull Semaphore semaphore, @NonNull @NonNull com.broadleafcommerce.search.api.type.IndexableType type, @NonNull @NonNull com.broadleafcommerce.search.index.core.queue.ReindexQueue<com.broadleafcommerce.search.index.core.queue.BatchIdHolder<String>> queue, @NonNull @NonNull com.broadleafcommerce.search.index.catalog.service.CatalogService catalogService, @NonNull @NonNull com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument> documentBuilder, @NonNull @NonNull com.broadleafcommerce.search.provider.solr.SolrIndexProvider solrIndexProvider, @NonNull @NonNull com.broadleafcommerce.search.provider.solr.SolrCollectionResolver collectionResolver, com.broadleafcommerce.common.extension.data.DataRouteSupporting searchSource, long waitTime, int maxTries)
-
-
Method Detail
-
executeInternal
protected int executeInternal(com.broadleafcommerce.search.index.core.queue.BatchIdHolder<String> queueEntry) throws com.broadleafcommerce.search.api.SearchIndexException
- Specified by:
executeInternal
in classcom.broadleafcommerce.search.index.core.worker.AbstractWorker<com.broadleafcommerce.search.index.core.queue.BatchIdHolder<String>>
- Throws:
com.broadleafcommerce.search.api.SearchIndexException
-
filterOmissions
protected void filterOmissions(Collection<List<com.broadleafcommerce.search.catalog.core.domain.Product>> productsById)
Filters out any products that haveomissions
. An omitted product is a product that has been deleted at the application level and should not be indexed.- Parameters:
productsById
- The products read from catalog
-
addProductsToBeOmitted
protected List<com.broadleafcommerce.search.catalog.core.domain.Product> addProductsToBeOmitted(List<com.broadleafcommerce.search.catalog.core.domain.Product> products, @Nullable Set<String> omittedCatalogs)
Given a set of omitted catalogs, returns the products that should be omitted.- Parameters:
products
- The list of productsomittedCatalogs
- The omitted catalogs- Returns:
- A list to add products that should be omitted.
-
collectCatalogsWithOmissions
protected Set<String> collectCatalogsWithOmissions(List<com.broadleafcommerce.search.catalog.core.domain.Product> products)
Retrieve a set of catalogs with omissions.- Parameters:
products
- The list of products- Returns:
- A set of catalog IDs where products are omitted.
-
shouldBeOmitted
protected boolean shouldBeOmitted(com.broadleafcommerce.search.catalog.core.domain.Product product, String omittedCatalog)
- Parameters:
product
- The product to test against.omittedCatalog
- The omitted catalog ID.- Returns:
- returns true if the product should be omitted from
omittedCatalog
, else false.
-
getCatalogService
protected com.broadleafcommerce.search.index.catalog.service.CatalogService getCatalogService()
-
getDocumentBuilder
protected com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument> getDocumentBuilder()
-
getSolrIndexProvider
protected com.broadleafcommerce.search.provider.solr.SolrIndexProvider getSolrIndexProvider()
-
getCollectionResolver
protected com.broadleafcommerce.search.provider.solr.SolrCollectionResolver getCollectionResolver()
-
-