public interface SolrIndexService
SolrIndexCachedOperation| Modifier and Type | Method and Description |
|---|---|
org.apache.solr.common.SolrInputDocument |
buildDocument(Product product,
List<Field> fields,
List<Locale> locales)
Given a product, fields that relate to that product, and a list of locales and pricelists, builds a
SolrInputDocument to be added to the Solr index.
|
void |
buildIncrementalIndex(int page,
int pageSize,
boolean useReindexServer)
The internal method for building indexes.
|
List<Locale> |
getAllLocales() |
void |
logDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents)
Prints out the docs to the trace logger
|
void |
optimizeIndex(org.apache.solr.client.solrj.SolrServer server)
Triggers the Solr optimize index function on the given server
|
void |
performCachedOperation(SolrIndexCachedOperation.CacheOperation cacheOperation)
SolrIndexService exposes
buildIncrementalIndex(int, int, boolean). |
void |
rebuildIndex()
Rebuilds the current index.
|
void |
restoreState(Object[] pack)
Restores state that was saved prior to indexing that might have been altered.
|
Object[] |
saveState()
Saves some global context that might be altered during indexing.
|
void rebuildIndex()
throws ServiceException,
IOException
IOExceptionServiceExceptionvoid buildIncrementalIndex(int page,
int pageSize,
boolean useReindexServer)
throws ServiceException
page - pageSize - useReindexServer - - if set to false will index directly on the primary serverServiceExceptionrestoreState(Object[])Object[] saveState()
void restoreState(Object[] pack)
pack - saveState()void optimizeIndex(org.apache.solr.client.solrj.SolrServer server)
throws ServiceException,
IOException
server - ServiceExceptionIOExceptionvoid logDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents)
documents - List<Locale> getAllLocales()
org.apache.solr.common.SolrInputDocument buildDocument(Product product, List<Field> fields, List<Locale> locales)
product - fields - locales - void performCachedOperation(SolrIndexCachedOperation.CacheOperation cacheOperation) throws ServiceException
buildIncrementalIndex(int, int, boolean).
By wrapping the call to this method inside of a SolrIndexCachedOperation.CacheOperation,
a single cache will be used for all the contained calls to buildIncrementalIndex. Here's an example:
{@code
performCachedOperation(new SolrIndexCachedOperation.CacheOperation() {cacheOperation - the block of code to perform using a single cache for best performanceServiceExceptionCopyright © 2015. All Rights Reserved.