Class BasicLuceneIndexer
java.lang.Object
com.softslate.commerce.businessobjects.core.BaseBusinessObject
com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
com.softslate.commerce.businessobjects.product.BaseLuceneProcessor
com.softslate.commerce.businessobjects.product.BasicLuceneIndexer
- All Implemented Interfaces:
BusinessObject,BusinessProcessor,LuceneIndexer
Class responsible for creating the Lucene index for advanced search
functionality.
- Author:
- Jason McWilliams, David Tobey
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.lucene.facet.taxonomy.TaxonomyWriterprivate org.apache.lucene.index.IndexWriter(package private) static org.apache.commons.logging.Logstatic final Stringstatic final StringFields inherited from class com.softslate.commerce.businessobjects.product.BaseLuceneProcessor
facetIndexDir, indexDir, suggestionsIndexDir -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllCategories(org.apache.lucene.index.IndexWriter writer) addAllManufacturers(org.apache.lucene.index.IndexWriter writer) addAllProducts(org.apache.lucene.index.IndexWriter writer, org.apache.lucene.facet.index.CategoryDocumentBuilder categoryDocBuilder) addEditCategory(int categoryID, String indexDir) addEditManufacturer(int manufacturerID, String indexDir) addEditProduct(int productID, String indexDir) voidaddStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer) voidaddStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer, String[] fieldsToIndex) compileCustomFacets(Product product) org.apache.lucene.facet.taxonomy.CategoryPathcompileFacetFromManufacturer(Product product) org.apache.lucene.facet.taxonomy.CategoryPathcompileFacetFromParentCategories(Product product) org.apache.lucene.facet.taxonomy.CategoryPathcompileFacetFromProductReviews(Product product) compileFacetsFromAttributes(Product product) compileFacetsFromProductSettings(Product product) org.apache.lucene.facet.taxonomy.CategoryPathcompilePriceRangeFacet(Product product) intgetTermHitCount(String fieldName, String searchString) org.apache.lucene.document.DocumentindexCategory(Category category) org.apache.lucene.document.DocumentindexManufacturer(Manufacturer manufacturer) org.apache.lucene.document.DocumentindexProduct(Product product) intindexProductFacets(Product product, org.apache.lucene.document.Document doc, org.apache.lucene.facet.index.CategoryDocumentBuilder categoryDocBuilder) org.apache.lucene.facet.taxonomy.TaxonomyWriterinitFacetWriter(File facetIndexDir, boolean resetIndex) org.apache.lucene.index.IndexWriterinitIndexWriter(File indexDir, boolean resetIndex) Methods inherited from class com.softslate.commerce.businessobjects.product.BaseLuceneProcessor
closeReaders, closeSuggestionsReader, copyNewIndexFilesIntoPlace, createAnalyzer, createSuggestionsAnalyzer, getFacetIndexDir, getFacetReader, getIndexDir, getIndexSearcher, getSuggestionsIndexDir, getSuggestionsSearcher, initFacetIndexDir, initIndexDir, initSuggestionsIndexDir, isFactedSearchEnabled, isSuggestionsEnabled, pad, pad, pruneArticlesFromName, restoreBackedUpIndexFiles, textFormatMethods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getEventBus, getInjector, getProductIDs, getSettings, getUser, initialize, isProcessorClassActive, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPGet, sendHTTPPost, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setEventBus, setInjector, setSettings, setUser, updateOrderTotals, updateOrderTotals, updateOrderTotals, utilsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initializeMethods inherited from interface com.softslate.commerce.businessobjects.core.BusinessProcessor
getAppComponents, getAppSettings, getBusinessObjectFactory, getDaoFactory, getEventBus, getInjector, getSettings, getUser, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setEventBus, setInjector, setSettings, setUser, utils
-
Field Details
-
log
static org.apache.commons.logging.Log log -
newIndexSubdirectory
- See Also:
-
oldIndexSubdirectory
- See Also:
-
indexWriter
private org.apache.lucene.index.IndexWriter indexWriter -
facetWriter
private org.apache.lucene.facet.taxonomy.TaxonomyWriter facetWriter
-
-
Constructor Details
-
BasicLuceneIndexer
public BasicLuceneIndexer()
-
-
Method Details
-
reindex
- Specified by:
reindexin interfaceLuceneIndexer- Throws:
Exception
-
initIndexWriter
public org.apache.lucene.index.IndexWriter initIndexWriter(File indexDir, boolean resetIndex) throws Exception - Throws:
Exception
-
initFacetWriter
public org.apache.lucene.facet.taxonomy.TaxonomyWriter initFacetWriter(File facetIndexDir, boolean resetIndex) throws Exception - Throws:
Exception
-
addAllProducts
public Map addAllProducts(org.apache.lucene.index.IndexWriter writer, org.apache.lucene.facet.index.CategoryDocumentBuilder categoryDocBuilder) throws Exception - Throws:
Exception
-
indexProduct
- Throws:
Exception
-
addEditProduct
- Specified by:
addEditProductin interfaceLuceneIndexer- Throws:
Exception
-
indexProductFacets
public int indexProductFacets(Product product, org.apache.lucene.document.Document doc, org.apache.lucene.facet.index.CategoryDocumentBuilder categoryDocBuilder) throws Exception - Throws:
Exception
-
compileFacetsFromProductSettings
-
compilePriceRangeFacet
-
compileFacetFromParentCategories
public org.apache.lucene.facet.taxonomy.CategoryPath compileFacetFromParentCategories(Product product) -
compileFacetFromManufacturer
-
compileFacetFromProductReviews
public org.apache.lucene.facet.taxonomy.CategoryPath compileFacetFromProductReviews(Product product) -
compileFacetsFromAttributes
-
compileCustomFacets
-
addAllCategories
- Throws:
Exception
-
indexCategory
- Throws:
Exception
-
addEditCategory
- Specified by:
addEditCategoryin interfaceLuceneIndexer- Throws:
Exception
-
addAllManufacturers
- Throws:
Exception
-
indexManufacturer
public org.apache.lucene.document.Document indexManufacturer(Manufacturer manufacturer) throws Exception - Throws:
Exception
-
addEditManufacturer
- Specified by:
addEditManufacturerin interfaceLuceneIndexer- Throws:
Exception
-
addStringFields
public void addStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer) throws Exception - Specified by:
addStringFieldsin interfaceLuceneIndexer- Throws:
Exception
-
addStringFields
public void addStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer, String[] fieldsToIndex) throws Exception - Specified by:
addStringFieldsin interfaceLuceneIndexer- Throws:
Exception
-
getTermHitCount
- Throws:
Exception
-