Sha256: 25548202f7af5aa123fa33b6c6b52c4a19d2386e8e1413906045e4506e6ba31b

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

require "celsius/transformation/step"
require "ox"

class Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchRequestTransformation::
  ProcessMatchQueries < Celsius::Transformation::Step

  def call
    if match_queries = Celsius::Hash.deep_find_key(source, :match)
      query_terms_node = transformation.inner_search_request.locate("PrimoSearchRequest/QueryTerms").first

      match_queries.each do |match_query|
        index_field = index_field_mapping(match_query.keys.first)
        value = match_query.values.first

        query_terms_node << Ox.parse(
          <<-xml
            <QueryTerm>
              <IndexField>#{index_field}</IndexField>
              <PrecisionOperator>exact</PrecisionOperator>
              <Value>#{value}</Value>
            </QueryTerm>
          xml
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
celsius-primo-0.1.4 lib/celsius/primo/soap_api/searcher/search_brief/search_request_transformation/process_match_queries.rb
celsius-primo-0.1.3 lib/celsius/primo/soap_api/searcher/search_brief/search_request_transformation/process_match_queries.rb