class Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchResultTransformation::ProcessFacets

Public Instance Methods

call() click to toggle source
# File lib/celsius/primo/soap_api/searcher/search_brief/search_result_transformation/process_facets.rb, line 7
def call
  if source_facets = search_brief_return.locate("JAGROOT/RESULT/FACETLIST/FACET")
    source_facets.each do |source_facet|
      target["facets"]["facet_#{source_facet["NAME"]}"] = target_facet(source_facet)
    end
  end
end

Private Instance Methods

target_facet(source_facet) click to toggle source
# File lib/celsius/primo/soap_api/searcher/search_brief/search_result_transformation/process_facets.rb, line 18
def target_facet(source_facet)
  {
    "_type" => "terms",
    "terms" => source_facet.locate("FACET_VALUES").map do |source_facet_value|
      {
        "term" => source_facet_value["KEY"].force_encoding("utf-8"),
        "count" => source_facet_value["VALUE"].to_i
      }
    end
  }
end