Class SolrReindexService

  • All Implemented Interfaces:
    com.broadleafcommerce.search.index.core.service.ReindexService

    public class SolrReindexService
    extends Object
    implements com.broadleafcommerce.search.index.core.service.ReindexService
    Solr specific implementation of Reindex service, used for reindexing single or multiple documents in real time.
    • Constructor Summary

      Constructors 
      Constructor Description
      SolrReindexService​(com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument> defaultDocumentBuilder, List<com.broadleafcommerce.search.index.core.document.IndexableTypeDocumentBuilder<?,​org.apache.solr.common.SolrInputDocument>> indexableTypeDocumentBuilders, com.broadleafcommerce.search.provider.solr.SolrIndexProvider solrIndexProvider, com.broadleafcommerce.search.provider.solr.SolrCollectionResolver solrCollectionResolver, int commitWithinTime)  
    • Field Detail

      • NO_COMMIT_WITHIN_TIME

        protected static final int NO_COMMIT_WITHIN_TIME
        See Also:
        Constant Field Values
    • Constructor Detail

      • SolrReindexService

        public SolrReindexService​(com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument> defaultDocumentBuilder,
                                  List<com.broadleafcommerce.search.index.core.document.IndexableTypeDocumentBuilder<?,​org.apache.solr.common.SolrInputDocument>> indexableTypeDocumentBuilders,
                                  com.broadleafcommerce.search.provider.solr.SolrIndexProvider solrIndexProvider,
                                  com.broadleafcommerce.search.provider.solr.SolrCollectionResolver solrCollectionResolver,
                                  int commitWithinTime)
    • Method Detail

      • reindex

        public void reindex​(List<? extends com.broadleafcommerce.search.api.domain.Indexable<?>> indexables)
                     throws com.broadleafcommerce.search.api.SearchIndexException
        Specified by:
        reindex in interface com.broadleafcommerce.search.index.core.service.ReindexService
        Throws:
        com.broadleafcommerce.search.api.SearchIndexException
      • getIndexablesToBuildDocuments

        protected List<? extends com.broadleafcommerce.search.api.domain.Indexable<?>> getIndexablesToBuildDocuments​(List<? extends com.broadleafcommerce.search.api.domain.Indexable<?>> indexables)
        Return a list of indexables to build documents for. This filters out any indexables that were not found.
        Parameters:
        indexables -
        Returns:
      • getDocumentBuilderForIndexableType

        protected com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument> getDocumentBuilderForIndexableType​(com.broadleafcommerce.search.api.type.IndexableType indexableType)
      • deleteByField

        public void deleteByField​(String fieldName,
                                  String fieldValue,
                                  com.broadleafcommerce.search.api.type.IndexableType indexableType)
                           throws com.broadleafcommerce.search.api.SearchIndexException
        Specified by:
        deleteByField in interface com.broadleafcommerce.search.index.core.service.ReindexService
        Throws:
        com.broadleafcommerce.search.api.SearchIndexException
      • commitDocuments

        protected void commitDocuments​(String... collections)
                                throws com.broadleafcommerce.search.api.SearchIndexException
        Throws:
        com.broadleafcommerce.search.api.SearchIndexException
      • getPrimaryCollection

        protected String getPrimaryCollection​(com.broadleafcommerce.search.api.type.IndexableType indexableType)
      • getSecondaryCollection

        protected String getSecondaryCollection​(com.broadleafcommerce.search.api.type.IndexableType indexableType)
      • isFullReindexInProgress

        protected boolean isFullReindexInProgress​(com.broadleafcommerce.search.api.type.IndexableType indexableType)
      • deleteByField

        protected void deleteByField​(String fieldName,
                                     String fieldValue,
                                     com.broadleafcommerce.search.api.type.IndexableType indexableType,
                                     boolean commit)
                              throws com.broadleafcommerce.search.api.SearchIndexException
        Throws:
        com.broadleafcommerce.search.api.SearchIndexException
      • deleteAll

        protected void deleteAll​(@Nullable
                                 List<? extends com.broadleafcommerce.search.api.domain.Indexable<?>> indexables,
                                 boolean commit)
      • getDefaultDocumentBuilder

        protected com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument> getDefaultDocumentBuilder()
      • getIndexableTypeDocumentBuilders

        protected Map<com.broadleafcommerce.search.api.type.IndexableType,​com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument>> getIndexableTypeDocumentBuilders()
      • getSolrIndexProvider

        protected com.broadleafcommerce.search.provider.solr.SolrIndexProvider getSolrIndexProvider()
      • getSolrCollectionResolver

        protected com.broadleafcommerce.search.provider.solr.SolrCollectionResolver getSolrCollectionResolver()
      • getCommitWithinTime

        protected int getCommitWithinTime()