Sha256: 559678f3dd61b0b8fe49ded060eb380f58db598503a5ad1ca0c1430b5d111cb0

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

require "transformator/transformation"
require_relative "../search"

class Skala::PrimoAdapter::Search::ResultTransformation < Transformator::Transformation
  require_directory "#{File.dirname(__FILE__)}/result_transformation"

  attr_accessor :search_brief_response
  attr_accessor :search_request

  def call(source, options = {})
    options[:target] ||= Skala::Adapter::Search::Result.new(source: source)
    @search_request = options[:search_request]
    super(source, options)
  end

  sequence [
    ParseSearchBriefResponse,
    SetTotalHits,
    [ # facets
      SetFacets,
      FixPrimoFacetsBugs,  # requires SetFacets to be run
      SortTermsFacetsTerms # requires all sanitations to be run
      #SortFacetsBySearchRequest,
      #RemoveFacetsIfEmpty,
      #ChangeFacetCreationdateToHistogramFacet,
      #SanitizeCreationdateFacet
    ],
    AddHits
  ]
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skala-1.1.0 lib/skala/primo_adapter/search/result_transformation.rb