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.TaxonomyWriter
private org.apache.lucene.index.IndexWriter
(package private) static org.apache.commons.logging.Log
static final String
static final String
Fields 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) void
addStringFields
(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer) void
addStringFields
(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer, String[] fieldsToIndex) compileCustomFacets
(Product product) org.apache.lucene.facet.taxonomy.CategoryPath
compileFacetFromManufacturer
(Product product) org.apache.lucene.facet.taxonomy.CategoryPath
compileFacetFromParentCategories
(Product product) org.apache.lucene.facet.taxonomy.CategoryPath
compileFacetFromProductReviews
(Product product) compileFacetsFromAttributes
(Product product) compileFacetsFromProductSettings
(Product product) org.apache.lucene.facet.taxonomy.CategoryPath
compilePriceRangeFacet
(Product product) int
getTermHitCount
(String fieldName, String searchString) org.apache.lucene.document.Document
indexCategory
(Category category) org.apache.lucene.document.Document
indexManufacturer
(Manufacturer manufacturer) org.apache.lucene.document.Document
indexProduct
(Product product) int
indexProductFacets
(Product product, org.apache.lucene.document.Document doc, org.apache.lucene.facet.index.CategoryDocumentBuilder categoryDocBuilder) org.apache.lucene.facet.taxonomy.TaxonomyWriter
initFacetWriter
(File facetIndexDir, boolean resetIndex) org.apache.lucene.index.IndexWriter
initIndexWriter
(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, textFormat
Methods 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, utils
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initialize
Methods 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:
reindex
in 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:
addEditProduct
in 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:
addEditCategory
in interfaceLuceneIndexer
- Throws:
Exception
-
addAllManufacturers
- Throws:
Exception
-
indexManufacturer
public org.apache.lucene.document.Document indexManufacturer(Manufacturer manufacturer) throws Exception - Throws:
Exception
-
addEditManufacturer
- Specified by:
addEditManufacturer
in interfaceLuceneIndexer
- Throws:
Exception
-
addStringFields
public void addStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer) throws Exception - Specified by:
addStringFields
in interfaceLuceneIndexer
- Throws:
Exception
-
addStringFields
public void addStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer, String[] fieldsToIndex) throws Exception - Specified by:
addStringFields
in interfaceLuceneIndexer
- Throws:
Exception
-
getTermHitCount
- Throws:
Exception
-