Interface SolrIndexProvider
- All Superinterfaces:
com.broadleafcommerce.search.provider.ReindexProvider<org.apache.solr.common.SolrInputDocument>
- All Known Implementing Classes:
DefaultSolrReindexProvider
- Author:
- Kelly Tisdell (ktisdell)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform a delete operation, deleting a list of document IDs from Solr.void
hardCommit
(String... indexNames) Initiates a Solr soft commit to each of the indices.void
Mechanism to allow rollbacks.void
softCommit
(String... indexNames) Initiates a Solr soft commit to each of the indices.void
Generic method to execute anUpdateRequest
for Solr.void
write
(List<org.apache.solr.common.SolrInputDocument> documents, int commitWithinMillis, String... indexNames) Overloads the method from the super interface, allowing the caller to specify how long until this should be committed to the index for searching.void
write
(org.apache.solr.common.SolrInputDocument document, int commitWithinMillis, String... indexNames) Overloads the method from the super interface, allowing the caller to specify how long until this should be committed to the index for searching.Methods inherited from interface com.broadleafcommerce.search.provider.ReindexProvider
deleteByField, write, write
-
Method Details
-
write
void write(List<org.apache.solr.common.SolrInputDocument> documents, int commitWithinMillis, String... indexNames) throws com.broadleafcommerce.search.api.SearchIndexException Overloads the method from the super interface, allowing the caller to specify how long until this should be committed to the index for searching.If the commitWithinMillis is less than or equal to zero then it is ignored.
Typically, commitWithinMillis will be between 1000-60000 (between 1-60 seconds).
Use a negative number for commitWithinMillis when doing a full reindex, and use the hardCommit method at the end of the process. Note that the smaller the commitWithinMillis parameter, the more it affects performance. The larger the number, the longer it will take to be searchable.
- Parameters:
documents
- the documents to writecommitWithinMillis
- time to commit within after writeindexNames
- the indices to write to- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if an error occurs writing to the index
-
write
void write(org.apache.solr.common.SolrInputDocument document, int commitWithinMillis, String... indexNames) throws com.broadleafcommerce.search.api.SearchIndexException Overloads the method from the super interface, allowing the caller to specify how long until this should be committed to the index for searching.If the commitWithinMillis is less than or equal to zero then it is ignored.
Typically, commitWithinMillis will be between 1000-60000 (between 1-60 seconds).
Use a negative number for commitWithinMillis when doing a full reindex, and use the hardCommit method at the end of the process. Note that the smaller the commitWithinMillis parameter, the more it affects performance. The larger the number, the longer it will take to be searchable.
- Parameters:
document
- the document to writecommitWithinMillis
- time to commit within after writeindexNames
- the indices to write to- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if an error occurs writing to the index
-
softCommit
Initiates a Solr soft commit to each of the indices. Soft commits make documents searchable, but do not necessarily make them persistent. Check the Solr documentation for more information.Remember that, unlike databases, Solr's commits and rollbacks are global, meaning that any client or thread that issues a commit or rollback does so for all clients and threads. It is a global process.
- Parameters:
indexNames
- the indices to soft commit- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if an error occurs performing the soft commit
-
hardCommit
Initiates a Solr soft commit to each of the indices. Soft commits make documents searchable, but do not necessarily make them persistent. Check the Solr documentation for more information.Remember that, unlike databases, Solr's commits and rollbacks are global, meaning that any client or thread that issues a commit or rollback does so for all clients and threads. It is a global process.
WARNING: Use this with caution. This should only be used rarely by a single control thread to commit batches. This can have negative performance impacts if used liberally. As a result this should only be used by a single thread after a full or bulk reindex. Check the Solr documentation for more information.
- Parameters:
indexNames
- the indices to hard commit- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if an error occurs performing the hard commit
-
write
void write(String collectionName, org.apache.solr.client.solrj.request.UpdateRequest updateRequest) throws com.broadleafcommerce.search.api.SearchIndexException Generic method to execute anUpdateRequest
for Solr. An update request allows for soft commits and for batches of SolrInputDocuments to be processed.- Parameters:
collectionName
- the collection to updateupdateRequest
- the update to write to the collection- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if an error occurs performing the update
-
delete
void delete(@Nullable List<String> documentIds, int commitWithinMillis, @NonNull String... indexNames) throws com.broadleafcommerce.search.api.SearchIndexException Perform a delete operation, deleting a list of document IDs from Solr.- Parameters:
documentIds
- A list of document IDs to be deleted.commitWithinMillis
- time to commit within after writeindexNames
- The name of the collections to update.- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- If an error occurs deleting documents.
-
rollback
Mechanism to allow rollbacks. Remember that, unlike databases, Solr's commits and rollbacks are global, meaning that any client or thread that issues a commit or rollback does so for all clients and threads. It is a global process.- Parameters:
collection
- the collection that should be rolled back- Throws:
com.broadleafcommerce.search.api.SearchIndexException
-