public interface SolrIndexService
SolrIndexCachedOperation| Modifier and Type | Method and Description |
|---|---|
void |
addDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents) |
void |
attachIndexableDocumentFields(org.apache.solr.common.SolrInputDocument document,
Indexable indexable,
List<IndexField> fields,
List<Locale> locales)
Iterates through the fields for this Indexable and indexes any IndexFields
|
org.apache.solr.common.SolrInputDocument |
buildDocument(Indexable indexable,
List<IndexField> 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.
|
Collection<org.apache.solr.common.SolrInputDocument> |
buildIncrementalIndex(List<? extends Indexable> indexables,
org.apache.solr.client.solrj.SolrClient solrServer)
Deprecated.
Use
buildIncrementalIndex(String, List, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName() |
Collection<org.apache.solr.common.SolrInputDocument> |
buildIncrementalIndex(String collection,
List<? extends Indexable> indexables,
org.apache.solr.client.solrj.SolrClient solrServer)
Builds a set of
Indexables against the given SolrServer |
void |
buildIndex()
Handles all the document building for the current index rebuild.
|
void |
commit(org.apache.solr.client.solrj.SolrClient server)
Deprecated.
Use
commit(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName() |
void |
commit(org.apache.solr.client.solrj.SolrClient server,
boolean softCommit,
boolean waitSearcher,
boolean waitFlush)
Deprecated.
Use
commit(String, SolrClient, boolean, boolean, boolean) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName() |
void |
commit(String collection,
org.apache.solr.client.solrj.SolrClient server)
Allows a commit to be called.
|
void |
commit(String collection,
org.apache.solr.client.solrj.SolrClient server,
boolean softCommit,
boolean waitSearcher,
boolean waitFlush)
This allows an external caller to force a commit to the SolrClient.
|
void |
deleteAllDocuments(org.apache.solr.client.solrj.SolrClient server)
Deprecated.
Use
deleteAllDocuments(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName() |
void |
deleteAllDocuments(String collection,
org.apache.solr.client.solrj.SolrClient server) |
void |
deleteAllNamespaceDocuments(org.apache.solr.client.solrj.SolrClient server)
Deprecated.
Use
deleteAllNamespaceDocuments(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName() |
void |
deleteAllNamespaceDocuments(String collection,
org.apache.solr.client.solrj.SolrClient server) |
void |
deleteByQuery(String deleteQuery) |
void |
executeSolrIndexOperation(SolrIndexOperation operation)
Executes the given operation in the correct method order
|
List<Locale> |
getAllLocales() |
SolrIndexOperation |
getReindexOperation()
Creates the SolrIndexOperation for rebuilding the current index, used by
buildIndex(). |
void |
logDeleteQuery(String deleteQuery) |
void |
logDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents)
Prints out the docs to the trace logger
|
void |
optimizeIndex(org.apache.solr.client.solrj.SolrClient server)
Deprecated.
Use
optimizeIndex(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName() |
void |
optimizeIndex(String collection,
org.apache.solr.client.solrj.SolrClient server)
Triggers the Solr optimize index function on the given server.
|
void |
performCachedOperation(SolrIndexCachedOperation.CacheOperation cacheOperation)
SolrIndexService exposes
#buildIncrementalIndex(int, int, boolean). |
void |
postBuildIndex()
Executed after we do any indexing when rebuilding the current index.
|
void |
preBuildIndex()
Executed before we do any indexing when rebuilding the index.
|
void |
rebuildIndex()
Executes a full rebuild of the Solr 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.
|
boolean |
useLegacyIndexer()
Indicates if this should be used.
|
void rebuildIndex()
throws ServiceException,
IOException
Executes a full rebuild of the Solr index. This will rebuild the index on a separate core/collection and then swap out the active core/collection with the new version of the index (essentially replacing all documents that are currently in the index).
The order of methods that are apart of rebuilding the entire index:
IOExceptionServiceExceptionvoid preBuildIndex()
throws ServiceException
rebuildIndex()ServiceExceptionvoid buildIndex()
throws IOException,
ServiceException
Handles all the document building for the current index rebuild. This is where all of the SolrIndexOperation's need to be created, executed and the documents built and added to the Solr index
This is the method that should be overridden to specify which operations should be run to build the correct index.
IOExceptionServiceException#rebuildIndex()},
#preBuildIndex()}void postBuildIndex()
throws IOException,
ServiceException
IOExceptionServiceExceptionSolrIndexOperation getReindexOperation()
buildIndex(). This is the primary
index operation used to rebuild the index.void executeSolrIndexOperation(SolrIndexOperation operation) throws ServiceException, IOException
operation - the SolrIndexOperation that is to be executedServiceExceptionIOExceptionCollection<org.apache.solr.common.SolrInputDocument> buildIncrementalIndex(String collection, List<? extends Indexable> indexables, org.apache.solr.client.solrj.SolrClient solrServer) throws ServiceException
Indexables against the given SolrServercollection - The collection to be used for incremental indexingindexables - the list of items to indexsolrServer - if non-null, adds and commits the indexed documents to the server. If this is null, this will
simply return the documents that were built from indexablesSolrInputDocuments that were built from the given indexablesServiceException@Deprecated Collection<org.apache.solr.common.SolrInputDocument> buildIncrementalIndex(List<? extends Indexable> indexables, org.apache.solr.client.solrj.SolrClient solrServer) throws ServiceException
buildIncrementalIndex(String, List, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName()Indexables against the given SolrServerindexables - the list of items to indexsolrServer - if non-null, adds and commits the indexed documents to the server. If this is null, this will
simply return the documents that were built from indexablesSolrInputDocuments that were built from the given indexablesServiceExceptionObject[] saveState()
void restoreState(Object[] pack)
pack - saveState()void optimizeIndex(String collection, org.apache.solr.client.solrj.SolrClient server) throws ServiceException, IOException
rebuildIndex()collection - The collection to optimizeserver - The server to use to optimze the given collectionServiceExceptionIOException@Deprecated void optimizeIndex(org.apache.solr.client.solrj.SolrClient server) throws ServiceException, IOException
optimizeIndex(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName()rebuildIndex()server - The server to use to optimze the default collectionServiceExceptionIOExceptionvoid commit(String collection, org.apache.solr.client.solrj.SolrClient server) throws ServiceException, IOException
collection - The collection to commitserver - The server used to commit the specified collectionServiceExceptionIOException@Deprecated void commit(org.apache.solr.client.solrj.SolrClient server) throws ServiceException, IOException
commit(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName()server - The server used to commit the default collectionServiceExceptionIOExceptionvoid commit(String collection, org.apache.solr.client.solrj.SolrClient server, boolean softCommit, boolean waitSearcher, boolean waitFlush) throws ServiceException, IOException
collection - The collection to commitserver - - the SolrClient to use to commit the provided collectionsoftCommit - - 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.ServiceExceptionIOException@Deprecated void commit(org.apache.solr.client.solrj.SolrClient server, boolean softCommit, boolean waitSearcher, boolean waitFlush) throws ServiceException, IOException
commit(String, SolrClient, boolean, boolean, boolean) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName()server - - the SolrClient to commit withsoftCommit - - 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 deleteAllNamespaceDocuments(String collection, org.apache.solr.client.solrj.SolrClient server) throws ServiceException
ServiceException@Deprecated void deleteAllNamespaceDocuments(org.apache.solr.client.solrj.SolrClient server) throws ServiceException
deleteAllNamespaceDocuments(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName()ServiceExceptionvoid deleteAllDocuments(String collection, org.apache.solr.client.solrj.SolrClient server) throws ServiceException
ServiceException@Deprecated void deleteAllDocuments(org.apache.solr.client.solrj.SolrClient server) throws ServiceException
deleteAllDocuments(String, SolrClient) instead so that the collection that's being used can be customized otherwise the default collection will always be used. Generally use SolrConfiguration#getQueryCollectionName() or SolrConfiguration#getReindexCollectionName()ServiceExceptionvoid logDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents)
documents - List<Locale> getAllLocales()
org.apache.solr.common.SolrInputDocument buildDocument(Indexable indexable, List<IndexField> 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 performanceServiceExceptionvoid attachIndexableDocumentFields(org.apache.solr.common.SolrInputDocument document,
Indexable indexable,
List<IndexField> fields,
List<Locale> locales)
document - indexable - fields - locales - void deleteByQuery(String deleteQuery) throws org.apache.solr.client.solrj.SolrServerException, IOException
org.apache.solr.client.solrj.SolrServerExceptionIOExceptionvoid addDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents) throws IOException, org.apache.solr.client.solrj.SolrServerException
IOExceptionorg.apache.solr.client.solrj.SolrServerExceptionvoid logDeleteQuery(String deleteQuery)
boolean useLegacyIndexer()
CatalogSolrIndexUpdateService. By default, this is driven by the property,
'solr.catalog.useLegacySolrIndexer', which defaults to true.Copyright © 2022. All rights reserved.