org.broadleafcommerce.core.search.service
Class DatabaseSearchServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.core.search.service.DatabaseSearchServiceImpl
All Implemented Interfaces:
SearchService

@Service(value="blSearchService")
public class DatabaseSearchServiceImpl
extends Object
implements SearchService


Field Summary
protected  net.sf.ehcache.Cache cache
           
protected static String CACHE_KEY_PREFIX
           
protected static String CACHE_NAME
           
protected  CatalogService catalogService
           
protected  FieldDao fieldDao
           
protected  SearchFacetDao searchFacetDao
           
 
Constructor Summary
DatabaseSearchServiceImpl()
           
 
Method Summary
protected  List<SearchFacetDTO> buildSearchFacetDtos(List<SearchFacet> categoryFacets)
          Create the wrapper DTO around the SearchFacet
 ProductSearchResult findExplicitProductsByCategory(Category category, ProductSearchCriteria searchCriteria)
          Performs a search for products in the given category, taking into consideration the ProductSearchCriteria This method will NOT return products that are in a sub-level of a given category.
 ProductSearchResult findProductsByCategory(Category category, ProductSearchCriteria searchCriteria)
          Performs a search for products in the given category, taking into consideration the ProductSearchCriteria This method will return products that are in any sub-level of a given category.
 ProductSearchResult findProductsByCategoryAndQuery(Category category, String query, ProductSearchCriteria searchCriteria)
          Performs a search for products in the given category for the given query, taking into consideration the ProductSearchCriteria
 ProductSearchResult findProductsByQuery(String query, ProductSearchCriteria searchCriteria)
          Performs a search for products across all categories for the given query, taking into consideration the ProductSearchCriteria
 List<SearchFacetDTO> getCategoryFacets(Category category)
          Gets all available facets for a given category
protected  String getDatabaseQualifiedFieldName(String qualifiedFieldName)
          From the Field's qualifiedName, build out the qualified name to be used by the ProductDao to find the requested products.
protected  List<SearchFacetResultDTO> getFacetValues(SearchFacet facet)
           
protected  List<SearchFacetResultDTO> getMatchFacetValues(SearchFacet facet)
           
protected  List<SearchFacetResultDTO> getRangeFacetValues(SearchFacet facet)
           
 List<SearchFacetDTO> getSearchFacets()
          Gets all available facets for search results page
 void rebuildIndex()
          This method delegates to SolrIndexService.rebuildIndex().
protected  void setActiveFacets(List<SearchFacetDTO> facets, ProductSearchCriteria searchCriteria)
           
protected  void setQualifiedKeys(ProductSearchCriteria criteria)
          Perform any necessary conversion of the key to be used by the search service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catalogService

protected CatalogService catalogService

searchFacetDao

protected SearchFacetDao searchFacetDao

fieldDao

protected FieldDao fieldDao

CACHE_NAME

protected static String CACHE_NAME

CACHE_KEY_PREFIX

protected static String CACHE_KEY_PREFIX

cache

protected net.sf.ehcache.Cache cache
Constructor Detail

DatabaseSearchServiceImpl

public DatabaseSearchServiceImpl()
Method Detail

findExplicitProductsByCategory

public ProductSearchResult findExplicitProductsByCategory(Category category,
                                                          ProductSearchCriteria searchCriteria)
                                                   throws ServiceException
Description copied from interface: SearchService
Performs a search for products in the given category, taking into consideration the ProductSearchCriteria This method will NOT return products that are in a sub-level of a given category. For example, if you had a "Routers" category and a "Enterprise Routers" sub-category, asking for products in "Routers", would NOT return products that are in the "Enterprise Routers" category.

Specified by:
findExplicitProductsByCategory in interface SearchService
Returns:
Throws:
ServiceException
See Also:
SearchService.findProductsByCategory(Category, ProductSearchCriteria)

findProductsByCategoryAndQuery

public ProductSearchResult findProductsByCategoryAndQuery(Category category,
                                                          String query,
                                                          ProductSearchCriteria searchCriteria)
                                                   throws ServiceException
Description copied from interface: SearchService
Performs a search for products in the given category for the given query, taking into consideration the ProductSearchCriteria

Specified by:
findProductsByCategoryAndQuery in interface SearchService
Throws:
ServiceException

findProductsByCategory

public ProductSearchResult findProductsByCategory(Category category,
                                                  ProductSearchCriteria searchCriteria)
Description copied from interface: SearchService
Performs a search for products in the given category, taking into consideration the ProductSearchCriteria This method will return products that are in any sub-level of a given category. For example, if you had a "Routers" category and a "Enterprise Routers" sub-category, asking for products in "Routers", would return products that are in the "Enterprise Routers" category.

Specified by:
findProductsByCategory in interface SearchService
Returns:
the result of the search
See Also:
SearchService.findExplicitProductsByCategory(Category, ProductSearchCriteria)

findProductsByQuery

public ProductSearchResult findProductsByQuery(String query,
                                               ProductSearchCriteria searchCriteria)
Description copied from interface: SearchService
Performs a search for products across all categories for the given query, taking into consideration the ProductSearchCriteria

Specified by:
findProductsByQuery in interface SearchService
Returns:
the result of the search

getSearchFacets

public List<SearchFacetDTO> getSearchFacets()
Description copied from interface: SearchService
Gets all available facets for search results page

Specified by:
getSearchFacets in interface SearchService
Returns:
the available facets

getCategoryFacets

public List<SearchFacetDTO> getCategoryFacets(Category category)
Description copied from interface: SearchService
Gets all available facets for a given category

Specified by:
getCategoryFacets in interface SearchService
Returns:
the available facets

setQualifiedKeys

protected void setQualifiedKeys(ProductSearchCriteria criteria)
Perform any necessary conversion of the key to be used by the search service

Parameters:
criteria -

getDatabaseQualifiedFieldName

protected String getDatabaseQualifiedFieldName(String qualifiedFieldName)
From the Field's qualifiedName, build out the qualified name to be used by the ProductDao to find the requested products.

Parameters:
qualifiedFieldName -
Returns:
the database qualified name

setActiveFacets

protected void setActiveFacets(List<SearchFacetDTO> facets,
                               ProductSearchCriteria searchCriteria)

buildSearchFacetDtos

protected List<SearchFacetDTO> buildSearchFacetDtos(List<SearchFacet> categoryFacets)
Create the wrapper DTO around the SearchFacet

Parameters:
categoryFacets -
Returns:
the wrapper DTO

getFacetValues

protected List<SearchFacetResultDTO> getFacetValues(SearchFacet facet)

getRangeFacetValues

protected List<SearchFacetResultDTO> getRangeFacetValues(SearchFacet facet)

getMatchFacetValues

protected List<SearchFacetResultDTO> getMatchFacetValues(SearchFacet facet)

rebuildIndex

public void rebuildIndex()
Description copied from interface: SearchService
This method delegates to SolrIndexService.rebuildIndex(). It is here to preserve backwards-compatibility with sites that were originally configured to run Broadleaf with Solr before 2.2.0.

Specified by:
rebuildIndex in interface SearchService


Copyright © 2013. All Rights Reserved.