@Service(value="blSolrIndexService") public class SolrIndexServiceImpl extends java.lang.Object implements SolrIndexService
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ATTR_MAP |
protected SolrSearchServiceExtensionManager |
extensionManager |
protected FieldDao |
fieldDao |
protected LocaleService |
localeService |
protected int |
pageSize |
protected ProductDao |
productDao |
protected SolrHelperService |
shs |
protected org.springframework.transaction.PlatformTransactionManager |
transactionManager |
| Constructor and Description |
|---|
SolrIndexServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
attachBasicDocumentFields(Product product,
org.apache.solr.common.SolrInputDocument document)
Adds the ID, category, and explicitCategory fields for the product to the document
|
protected org.apache.solr.common.SolrInputDocument |
buildDocument(Product product,
java.util.List<Field> fields,
java.util.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.
|
protected void |
buildIncrementalIndex(int page,
int pageSize) |
protected java.lang.String |
convertToMappedProperty(java.lang.String propertyName,
java.lang.String listPropertyName,
java.lang.String mapPropertyName)
Converts a propertyName to one that is able to reference inside a map.
|
protected void |
deleteAllDocuments() |
protected void |
finalizeTransaction(org.springframework.transaction.TransactionStatus status,
boolean isError) |
protected java.util.List<Locale> |
getAllLocales() |
protected java.util.Map<java.lang.String,java.lang.Object> |
getPropertyValues(Product product,
Field field,
FieldType fieldType,
java.util.List<Locale> locales)
Returns a map of prefix to value for the requested attributes.
|
protected java.util.List<Product> |
readAllActiveProducts()
This method to read all active products will be slow if you have a large catalog.
|
protected java.util.List<Product> |
readAllActiveProducts(int page,
int pageSize)
This method to read active products utilizes paging to improve performance over
readAllActiveProducts(). |
void |
rebuildIndex()
Rebuilds the current index.
|
@Value(value="${solr.index.product.pageSize}")
protected int pageSize
protected ProductDao productDao
protected FieldDao fieldDao
protected LocaleService localeService
protected SolrHelperService shs
protected SolrSearchServiceExtensionManager extensionManager
protected org.springframework.transaction.PlatformTransactionManager transactionManager
public static java.lang.String ATTR_MAP
public void rebuildIndex()
throws ServiceException,
java.io.IOException
SolrIndexServicerebuildIndex in interface SolrIndexServiceServiceExceptionjava.io.IOExceptionprotected void deleteAllDocuments()
throws ServiceException
ServiceExceptionprotected void buildIncrementalIndex(int page,
int pageSize)
throws ServiceException
ServiceExceptionprotected void finalizeTransaction(org.springframework.transaction.TransactionStatus status,
boolean isError)
protected java.util.List<Product> readAllActiveProducts()
protected java.util.List<Product> readAllActiveProducts(int page, int pageSize)
readAllActiveProducts().
While not optimal, this will reduce the memory required to load large catalogs.
It could still be improved for specific implementations by only loading fields that will be indexed or by accessing
the database via direct JDBC (instead of Hibernate).protected java.util.List<Locale> getAllLocales()
protected org.apache.solr.common.SolrInputDocument buildDocument(Product product, java.util.List<Field> fields, java.util.List<Locale> locales)
product - fields - locales - protected void attachBasicDocumentFields(Product product, org.apache.solr.common.SolrInputDocument document)
product - document - protected java.util.Map<java.lang.String,java.lang.Object> getPropertyValues(Product product, Field field, FieldType fieldType, java.util.List<Locale> locales) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
product - field - isPriceField - prefix - java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionprotected java.lang.String convertToMappedProperty(java.lang.String propertyName,
java.lang.String listPropertyName,
java.lang.String mapPropertyName)
propertyName - listPropertyName - mapPropertyName - Copyright © 2018. All Rights Reserved.