Class: Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchResultTransformation::SortFacetsBySearchRequest
- Inherits:
-
Transformation::Step
- Object
- Transformation::Step
- Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchResultTransformation::SortFacetsBySearchRequest
- Defined in:
- lib/celsius/primo/soap_api/searcher/search_brief/search_result_transformation/sort_facets_by_search_request.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/celsius/primo/soap_api/searcher/search_brief/search_result_transformation/sort_facets_by_search_request.rb', line 7 def call if requested_facets_names = Celsius::Hash.deep_find_key(search_request, [:facets, :field]) original_target_facets = target["facets"] # ruby has a order-preserving hash, so sorting means recreating with the desired order target["facets"] = {}.tap do |target_facets| requested_facets_names.each do |facet_name| if original_target_facet_value = original_target_facets[facet_name] target_facets[facet_name] = original_target_facet_value end end end end end |