Class BasicLuceneSearcher
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.BasicLuceneSearcher
- All Implemented Interfaces:
BusinessObject
,BusinessProcessor
,LuceneSearcher
- Direct Known Subclasses:
BasicLuceneSuggestionsSearcher
Class responsible for searching on the Lucene index for advanced search
functionality.
- Author:
- Jason McWilliams, David Tobey
-
Field Summary
Fields inherited from class com.softslate.commerce.businessobjects.product.BaseLuceneProcessor
facetIndexDir, indexDir, suggestionsIndexDir
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDefaultOperatorToParser
(org.apache.lucene.queryParser.QueryParser parser, String advancedSearchMatchStyle) protected void
addFuzzinessToParser
(org.apache.lucene.queryParser.QueryParser parser, String advancedSearchFuzziness) protected String
addFuzzinessToSearchString
(String searchString, String advancedSearchMatchStyle) protected String
addQuotesToSearchString
(String searchString, String advancedSearchMatchStyle) protected String
addWildcardsToSearchString
(String searchString, String advancedSearchMatchStyle) protected String
appendToEachTermInSearchString
(String searchString, String toAppend) protected String
createHighlightedExcerpt
(Object object, SearchList searchList) protected org.apache.lucene.search.highlight.Highlighter
createHighlighter
(SearchList searchList) protected org.apache.lucene.queryParser.QueryParser
createParser
(SearchList searchList, String field, org.apache.lucene.analysis.Analyzer analyzer, String advancedSearchMatchStyle, String advancedSearchFuzziness) protected org.apache.lucene.queryParser.QueryParser
createParserUsingDefaults
(SearchList searchList) protected org.apache.lucene.search.TopDocsCollector
createTopDocsCollector
(org.apache.lucene.search.Sort sort) protected org.apache.lucene.search.Query
determineQueryForAllDocuments
(SearchList searchList) protected org.apache.lucene.search.Query
determineQueryForCategories
(SearchList searchList) protected org.apache.lucene.search.Query
determineQueryForManufacturers
(SearchList searchList) protected org.apache.lucene.search.Query
determineQueryForProducts
(SearchList searchList) protected org.apache.lucene.search.Query
determineQueryForProductsForProductList
(SearchList searchList) protected org.apache.lucene.search.Query
determineQueryForProductsWithinCategory
(SearchList searchList) protected org.apache.lucene.search.Query
protected org.apache.lucene.search.Sort
determineSort
(SearchList searchList) getFacetCounts
(SearchList searchList) getSearchList
(SearchList searchList) protected boolean
isReservedTerm
(String term) protected SearchList
loadSearchListFromDatabase
(SearchList searchList, org.apache.lucene.search.TopDocs hits) protected org.apache.lucene.search.Query
parseSearchString
(org.apache.lucene.queryParser.QueryParser parser, String searchString) protected org.apache.lucene.search.TopDocs
performSearch
(org.apache.lucene.search.Query mainQuery, int numberOfItems, org.apache.lucene.search.Sort sort) protected org.apache.lucene.search.TopDocs
performSearch
(org.apache.lucene.search.Query mainQuery, int numberOfItems, org.apache.lucene.search.Sort sort, SearchList searchList) protected org.apache.lucene.search.TopDocs
searchAllDocuments
(SearchList searchList) protected org.apache.lucene.search.TopDocs
searchCategories
(SearchList searchList) protected org.apache.lucene.search.TopDocs
searchCustom
(SearchList searchList) protected Collection
searchFacetsForAllDocuments
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected Collection
searchFacetsForCategories
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected Collection
searchFacetsForCustom
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected Collection
searchFacetsForManufacturers
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected Collection
searchFacetsForProducts
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected Collection
searchFacetsForProductsForProductList
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected Collection
searchFacetsForProductsWithinCategory
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected Collection
searchFacetsForProductsWithinManufacturer
(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected SearchList
searchForDocuments
(SearchList searchList) protected SearchList
searchForFacetCounts
(SearchList searchList) protected org.apache.lucene.search.TopDocs
searchManufacturers
(SearchList searchList) protected org.apache.lucene.search.TopDocs
searchProducts
(SearchList searchList) protected org.apache.lucene.search.TopDocs
searchProductsForProductList
(SearchList searchList) protected org.apache.lucene.search.TopDocs
searchProductsWithinCategory
(SearchList searchList) protected org.apache.lucene.search.TopDocs
searchProductsWithinManufacturer
(SearchList searchList) 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
-
-
Constructor Details
-
BasicLuceneSearcher
public BasicLuceneSearcher()
-
-
Method Details
-
getSearchList
- Specified by:
getSearchList
in interfaceLuceneSearcher
- Throws:
Exception
-
getFacetCounts
- Specified by:
getFacetCounts
in interfaceLuceneSearcher
- Throws:
Exception
-
searchForDocuments
- Throws:
Exception
-
searchProducts
- Throws:
Exception
-
searchProductsWithinCategory
protected org.apache.lucene.search.TopDocs searchProductsWithinCategory(SearchList searchList) throws Exception - Throws:
Exception
-
searchProductsWithinManufacturer
protected org.apache.lucene.search.TopDocs searchProductsWithinManufacturer(SearchList searchList) throws Exception - Throws:
Exception
-
searchProductsForProductList
protected org.apache.lucene.search.TopDocs searchProductsForProductList(SearchList searchList) throws Exception - Throws:
Exception
-
searchCategories
- Throws:
Exception
-
searchManufacturers
protected org.apache.lucene.search.TopDocs searchManufacturers(SearchList searchList) throws Exception - Throws:
Exception
-
searchAllDocuments
protected org.apache.lucene.search.TopDocs searchAllDocuments(SearchList searchList) throws Exception - Throws:
Exception
-
determineQueryForProductsWithinManufacturer
protected org.apache.lucene.search.Query determineQueryForProductsWithinManufacturer(SearchList searchList) throws Exception - Throws:
Exception
-
determineQueryForProductsForProductList
protected org.apache.lucene.search.Query determineQueryForProductsForProductList(SearchList searchList) throws Exception - Throws:
Exception
-
determineQueryForCategories
protected org.apache.lucene.search.Query determineQueryForCategories(SearchList searchList) throws Exception - Throws:
Exception
-
determineQueryForManufacturers
protected org.apache.lucene.search.Query determineQueryForManufacturers(SearchList searchList) throws Exception - Throws:
Exception
-
determineQueryForAllDocuments
protected org.apache.lucene.search.Query determineQueryForAllDocuments(SearchList searchList) throws Exception - Throws:
Exception
-
searchCustom
- Throws:
Exception
-
determineQueryForProducts
protected org.apache.lucene.search.Query determineQueryForProducts(SearchList searchList) throws Exception - Throws:
Exception
-
determineQueryForProductsWithinCategory
protected org.apache.lucene.search.Query determineQueryForProductsWithinCategory(SearchList searchList) throws Exception - Throws:
Exception
-
determineSort
-
createParserUsingDefaults
protected org.apache.lucene.queryParser.QueryParser createParserUsingDefaults(SearchList searchList) throws Exception - Throws:
Exception
-
createParser
protected org.apache.lucene.queryParser.QueryParser createParser(SearchList searchList, String field, org.apache.lucene.analysis.Analyzer analyzer, String advancedSearchMatchStyle, String advancedSearchFuzziness) throws Exception - Throws:
Exception
-
addDefaultOperatorToParser
protected void addDefaultOperatorToParser(org.apache.lucene.queryParser.QueryParser parser, String advancedSearchMatchStyle) -
addFuzzinessToParser
protected void addFuzzinessToParser(org.apache.lucene.queryParser.QueryParser parser, String advancedSearchFuzziness) -
addFuzzinessToSearchString
-
addWildcardsToSearchString
-
appendToEachTermInSearchString
-
addQuotesToSearchString
-
isReservedTerm
-
parseSearchString
protected org.apache.lucene.search.Query parseSearchString(org.apache.lucene.queryParser.QueryParser parser, String searchString) throws org.apache.lucene.queryParser.ParseException - Throws:
org.apache.lucene.queryParser.ParseException
-
performSearch
protected org.apache.lucene.search.TopDocs performSearch(org.apache.lucene.search.Query mainQuery, int numberOfItems, org.apache.lucene.search.Sort sort) throws Exception - Throws:
Exception
-
performSearch
protected org.apache.lucene.search.TopDocs performSearch(org.apache.lucene.search.Query mainQuery, int numberOfItems, org.apache.lucene.search.Sort sort, SearchList searchList) throws Exception - Throws:
Exception
-
createTopDocsCollector
protected org.apache.lucene.search.TopDocsCollector createTopDocsCollector(org.apache.lucene.search.Sort sort) throws IOException - Throws:
IOException
-
loadSearchListFromDatabase
protected SearchList loadSearchListFromDatabase(SearchList searchList, org.apache.lucene.search.TopDocs hits) throws Exception - Throws:
Exception
-
createHighlightedExcerpt
-
createHighlighter
-
searchForFacetCounts
- Throws:
Exception
-
searchFacetsForProducts
protected Collection searchFacetsForProducts(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-
searchFacetsForProductsWithinCategory
protected Collection searchFacetsForProductsWithinCategory(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-
searchFacetsForProductsWithinManufacturer
protected Collection searchFacetsForProductsWithinManufacturer(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-
searchFacetsForProductsForProductList
protected Collection searchFacetsForProductsForProductList(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-
searchFacetsForCategories
protected Collection searchFacetsForCategories(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-
searchFacetsForManufacturers
protected Collection searchFacetsForManufacturers(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-
searchFacetsForAllDocuments
protected Collection searchFacetsForAllDocuments(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-
searchFacetsForCustom
protected Collection searchFacetsForCustom(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) throws Exception - Throws:
Exception
-