lib/tire/multi_search.rb
# Serializes the search definitions as an array of JSON definitions
#
Serializes the search definitions as an array of JSON definitions
Serializes the search definitions as an array of JSON definitions
def to_array
          @searches.map do |search|
            header = {}
            header.update(:index => search.indices.join(',')) unless search.indices.empty?
            header.update(:type  => search.types.join(','))   unless search.types.empty?
            header.update(:search_type => search.options[:search_type]) if search.options[:search_type]
            header.update(:routing     => search.options[:routing])     if search.options[:routing]
            header.update(:preference  => search.options[:preference])  if search.options[:preference]
            body   = search.to_hash
            [ header, body ]
          end.flatten
        end
def to_array @searches . map do | search | header = { } header . update ( :index => search . indices . join ( ',' ) ) unless search . indices . empty? header . update ( :type => search . types . join ( ',' ) ) unless search . types . empty? header . update ( :search_type => search . options [ :search_type ] ) if search . options [ :search_type ] header . update ( :routing => search . options [ :routing ] ) if search . options [ :routing ] header . update ( :preference => search . options [ :preference ] ) if search . options [ :preference ] body = search . to_hash [ header , body ] end . flatten end
Serializes the search definitions as an array of JSON definitions
Serializes the search definitions as an array of JSON definitions