@Service(value="blSolrIndexService") public class SolrIndexServiceImpl extends Object implements SolrIndexService
| Modifier and Type | Field and Description |
|---|---|
static 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,
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.
|
protected void |
buildIncrementalIndex(int page,
int pageSize) |
protected String |
convertToMappedProperty(String propertyName,
String listPropertyName,
String mapPropertyName)
Converts a propertyName to one that is able to reference inside a map.
|
protected void |
deleteAllDocuments() |
protected List<Locale> |
getAllLocales() |
protected Map<String,Object> |
getPropertyValues(Product product,
Field field,
FieldType fieldType,
List<Locale> locales)
Returns a map of prefix to value for the requested attributes.
|
protected List<Product> |
readAllActiveProducts()
This method to read all active products will be slow if you have a large catalog.
|
protected 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 String ATTR_MAP
public void rebuildIndex()
throws ServiceException,
IOException
SolrIndexServicerebuildIndex in interface SolrIndexServiceServiceExceptionIOExceptionprotected void deleteAllDocuments()
throws ServiceException
ServiceExceptionprotected void buildIncrementalIndex(int page,
int pageSize)
throws ServiceException
ServiceExceptionprotected List<Product> readAllActiveProducts()
protected 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 List<Locale> getAllLocales()
protected org.apache.solr.common.SolrInputDocument buildDocument(Product product, List<Field> fields, List<Locale> locales)
product - fields - locales - protected void attachBasicDocumentFields(Product product, org.apache.solr.common.SolrInputDocument document)
product - document - protected Map<String,Object> getPropertyValues(Product product, Field field, FieldType fieldType, List<Locale> locales) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
product - field - isPriceField - prefix - IllegalAccessExceptionInvocationTargetExceptionNoSuchMethodExceptionprotected String convertToMappedProperty(String propertyName, String listPropertyName, String mapPropertyName)
propertyName - listPropertyName - mapPropertyName - Copyright © 2014. All Rights Reserved.