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.
|
org.apache.solr.common.SolrInputDocument |
buildDocument(Sku sku,
List<Field> fields,
List<Locale> locales)
Given a sku, fields that relate to that sku, 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.
|
void |
buildIncrementalProductIndex(List<Product> products,
boolean useReindexServer)
This can be used in lieu of passing in page sizes, The reason is that one might want to apply filters or only
index certain products.
|
void |
buildIncrementalSkuIndex(List<Sku> skus,
boolean useReindexServer)
This can be used in lieu of passing in page sizes, The reason is that one might want to apply filters or only
index certain skus.
|
void |
commit(org.apache.solr.client.solrj.SolrServer server)
Allows a commit to be called.
|
void |
commit(org.apache.solr.client.solrj.SolrServer server,
boolean softCommit,
boolean waitSearcher,
boolean waitFlush)
This allows an external caller to force a commit to the SolrServer.
|
List<Locale> |
getAllLocales() |
boolean |
isReindexInProcess()
Allows a query to determine if a full reindex is currently being performed.
|
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
IOExceptionServiceExceptionboolean isReindexInProcess()
void buildIncrementalIndex(int page,
int pageSize,
boolean useReindexServer)
throws ServiceException
page - pageSize - useReindexServer - - if set to false will index directly on the primary serverServiceExceptionrestoreState(Object[])void buildIncrementalSkuIndex(List<Sku> skus, boolean useReindexServer) throws ServiceException
skus - useReindexServer - ServiceExceptionvoid buildIncrementalProductIndex(List<Product> products, boolean useReindexServer) throws ServiceException
products - useReindexServer - ServiceExceptionObject[] saveState()
void restoreState(Object[] pack)
pack - saveState()void optimizeIndex(org.apache.solr.client.solrj.SolrServer server)
throws ServiceException,
IOException
server - ServiceExceptionIOExceptionvoid commit(org.apache.solr.client.solrj.SolrServer server)
throws ServiceException,
IOException
server - ServiceExceptionIOExceptionvoid commit(org.apache.solr.client.solrj.SolrServer server,
boolean softCommit,
boolean waitSearcher,
boolean waitFlush)
throws ServiceException,
IOException
server - - the SolrServer to updatesoftCommit - - soft commit is an efficient commit that does not write the data to the file systemwaitSearcher - - whether or not to wait for a new searcher to be createdwaitFlush - - whether or not to wait for a flush to disk.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 - org.apache.solr.common.SolrInputDocument buildDocument(Sku sku, List<Field> fields, List<Locale> locales)
sku - 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 © 2017. All rights reserved.