Class SolrReindexService
- java.lang.Object
-
- com.broadleafcommerce.search.index.solr.service.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
NO_COMMIT_WITHIN_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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
commitDocuments(String... collections)
protected void
deleteAll(List<? extends com.broadleafcommerce.search.api.domain.Indexable<?>> indexables, boolean commit)
void
deleteByField(String fieldName, String fieldValue, com.broadleafcommerce.search.api.type.IndexableType indexableType)
protected void
deleteByField(String fieldName, String fieldValue, com.broadleafcommerce.search.api.type.IndexableType indexableType, boolean commit)
protected int
getCommitWithinTime()
protected com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument>
getDefaultDocumentBuilder()
protected com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument>
getDocumentBuilderForIndexableType(com.broadleafcommerce.search.api.type.IndexableType indexableType)
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.protected Map<com.broadleafcommerce.search.api.type.IndexableType,com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument>>
getIndexableTypeDocumentBuilders()
protected String
getPrimaryCollection(com.broadleafcommerce.search.api.type.IndexableType indexableType)
protected String
getSecondaryCollection(com.broadleafcommerce.search.api.type.IndexableType indexableType)
protected com.broadleafcommerce.search.provider.solr.SolrCollectionResolver
getSolrCollectionResolver()
protected com.broadleafcommerce.search.provider.solr.SolrIndexProvider
getSolrIndexProvider()
protected boolean
isFullReindexInProgress(com.broadleafcommerce.search.api.type.IndexableType indexableType)
void
reindex(List<? extends com.broadleafcommerce.search.api.domain.Indexable<?>> indexables)
-
-
-
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 interfacecom.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 werenot 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 interfacecom.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()
-
-