Class SolrResponseSortDecorator
- java.lang.Object
-
- com.broadleafcommerce.search.provider.solr.response.SolrResponseSortDecorator
-
- All Implemented Interfaces:
SolrResponseDecorator
public class SolrResponseSortDecorator extends Object implements SolrResponseDecorator
Decorates theSearchResponse
withSortOption
s associated to the current search.
-
-
Constructor Summary
Constructors Constructor Description SolrResponseSortDecorator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.broadleafcommerce.search.api.domain.SortResponse
buildSortResponse(com.broadleafcommerce.search.api.domain.SortOption sortOption, org.springframework.data.domain.Pageable page)
Create the sort response for theSortOption
and current sort on thePageable
.<T extends com.broadleafcommerce.search.api.domain.SearchResponse>
voiddecorate(T searchResponse, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, org.apache.solr.client.solrj.response.QueryResponse queryResponse, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Add all active and inactiveSortOption
s to theSearchResponse
for this search.protected org.springframework.data.domain.Sort.Order
getCurrentSortForOption(com.broadleafcommerce.search.api.domain.SortOption sortOption, org.springframework.data.domain.Pageable page)
protected com.broadleafcommerce.search.api.domain.SortOption
simplifySortOption(com.broadleafcommerce.search.api.domain.SortOption sortOption)
RemoveFieldDefinition
from sort option for response.
-
-
-
Method Detail
-
decorate
public <T extends com.broadleafcommerce.search.api.domain.SearchResponse> void decorate(T searchResponse, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, org.apache.solr.client.solrj.response.QueryResponse queryResponse, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Add all active and inactiveSortOption
s to theSearchResponse
for this search.SortOption
s will be sorted by Display Order.- Specified by:
decorate
in interfaceSolrResponseDecorator
- Parameters:
searchResponse
- Search response to be updatedsearchRequest
- The original search request producing this responsequeryResponse
- The query response from Solrpage
- The requested page for the searchproperties
-context
- (optional) The context information surrounding sandboxing/multitenant statefieldDefinitions
- An unmodifiable list of field definitions used on the original search
-
buildSortResponse
protected com.broadleafcommerce.search.api.domain.SortResponse buildSortResponse(com.broadleafcommerce.search.api.domain.SortOption sortOption, org.springframework.data.domain.Pageable page)
Create the sort response for theSortOption
and current sort on thePageable
.- Parameters:
sortOption
- the sort option to create a response forpage
- the page with the current sort- Returns:
- the sort response for the option and current page
-
getCurrentSortForOption
@Nullable protected org.springframework.data.domain.Sort.Order getCurrentSortForOption(com.broadleafcommerce.search.api.domain.SortOption sortOption, org.springframework.data.domain.Pageable page)
-
simplifySortOption
protected com.broadleafcommerce.search.api.domain.SortOption simplifySortOption(com.broadleafcommerce.search.api.domain.SortOption sortOption)
RemoveFieldDefinition
from sort option for response.- Parameters:
sortOption
- Sort option to remove field from- Returns:
- Sort option with field removed
-
-