Class 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 the SortOption and current sort on the Pageable.
      <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, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Add all active and inactive SortOptions to the SearchResponse 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)
      Remove FieldDefinition from sort option for response.
    • Constructor Detail

      • SolrResponseSortDecorator

        public SolrResponseSortDecorator()
    • 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 inactive SortOptions to the SearchResponse for this search.

        SortOptions will be sorted by Display Order.

        Specified by:
        decorate in interface SolrResponseDecorator
        Parameters:
        searchResponse - Search response to be updated
        searchRequest - The original search request producing this response
        queryResponse - The query response from Solr
        page - The requested page for the search
        properties -
        context - (optional) The context information surrounding sandboxing/multitenant state
        fieldDefinitions - 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 the SortOption and current sort on the Pageable.
        Parameters:
        sortOption - the sort option to create a response for
        page - 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)
        Remove FieldDefinition from sort option for response.
        Parameters:
        sortOption - Sort option to remove field from
        Returns:
        Sort option with field removed