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
FieldsFields inherited from class com.softslate.commerce.businessobjects.product.BaseLuceneProcessor
facetIndexDir, indexDir, suggestionsIndexDir -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDefaultOperatorToParser(org.apache.lucene.queryParser.QueryParser parser, String advancedSearchMatchStyle) protected voidaddFuzzinessToParser(org.apache.lucene.queryParser.QueryParser parser, String advancedSearchFuzziness) protected StringaddFuzzinessToSearchString(String searchString, String advancedSearchMatchStyle) protected StringaddQuotesToSearchString(String searchString, String advancedSearchMatchStyle) protected StringaddWildcardsToSearchString(String searchString, String advancedSearchMatchStyle) protected StringappendToEachTermInSearchString(String searchString, String toAppend) protected StringcreateHighlightedExcerpt(Object object, SearchList searchList) protected org.apache.lucene.search.highlight.HighlightercreateHighlighter(SearchList searchList) protected org.apache.lucene.queryParser.QueryParsercreateParser(SearchList searchList, String field, org.apache.lucene.analysis.Analyzer analyzer, String advancedSearchMatchStyle, String advancedSearchFuzziness) protected org.apache.lucene.queryParser.QueryParsercreateParserUsingDefaults(SearchList searchList) protected org.apache.lucene.search.TopDocsCollectorcreateTopDocsCollector(org.apache.lucene.search.Sort sort) protected org.apache.lucene.search.QuerydetermineQueryForAllDocuments(SearchList searchList) protected org.apache.lucene.search.QuerydetermineQueryForCategories(SearchList searchList) protected org.apache.lucene.search.QuerydetermineQueryForManufacturers(SearchList searchList) protected org.apache.lucene.search.QuerydetermineQueryForProducts(SearchList searchList) protected org.apache.lucene.search.QuerydetermineQueryForProductsForProductList(SearchList searchList) protected org.apache.lucene.search.QuerydetermineQueryForProductsWithinCategory(SearchList searchList) protected org.apache.lucene.search.Queryprotected org.apache.lucene.search.SortdetermineSort(SearchList searchList) getFacetCounts(SearchList searchList) getSearchList(SearchList searchList) protected booleanisReservedTerm(String term) protected SearchListloadSearchListFromDatabase(SearchList searchList, org.apache.lucene.search.TopDocs hits) protected org.apache.lucene.search.QueryparseSearchString(org.apache.lucene.queryParser.QueryParser parser, String searchString) protected org.apache.lucene.search.TopDocsperformSearch(org.apache.lucene.search.Query mainQuery, int numberOfItems, org.apache.lucene.search.Sort sort) protected org.apache.lucene.search.TopDocsperformSearch(org.apache.lucene.search.Query mainQuery, int numberOfItems, org.apache.lucene.search.Sort sort, SearchList searchList) protected org.apache.lucene.search.TopDocssearchAllDocuments(SearchList searchList) protected org.apache.lucene.search.TopDocssearchCategories(SearchList searchList) protected org.apache.lucene.search.TopDocssearchCustom(SearchList searchList) protected CollectionsearchFacetsForAllDocuments(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected CollectionsearchFacetsForCategories(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected CollectionsearchFacetsForCustom(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected CollectionsearchFacetsForManufacturers(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected CollectionsearchFacetsForProducts(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected CollectionsearchFacetsForProductsForProductList(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected CollectionsearchFacetsForProductsWithinCategory(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected CollectionsearchFacetsForProductsWithinManufacturer(SearchList searchList, org.apache.lucene.search.IndexSearcher searcher, LuceneFacetHelper lfh) protected SearchListsearchForDocuments(SearchList searchList) protected SearchListsearchForFacetCounts(SearchList searchList) protected org.apache.lucene.search.TopDocssearchManufacturers(SearchList searchList) protected org.apache.lucene.search.TopDocssearchProducts(SearchList searchList) protected org.apache.lucene.search.TopDocssearchProductsForProductList(SearchList searchList) protected org.apache.lucene.search.TopDocssearchProductsWithinCategory(SearchList searchList) protected org.apache.lucene.search.TopDocssearchProductsWithinManufacturer(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, 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
-
-
Constructor Details
-
BasicLuceneSearcher
public BasicLuceneSearcher()
-
-
Method Details
-
getSearchList
- Specified by:
getSearchListin interfaceLuceneSearcher- Throws:
Exception
-
getFacetCounts
- Specified by:
getFacetCountsin 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
-