lib/oedipus/index.rb
def multi_search(queries)
      unless queries.kind_of?(Hash)
        raise ArgumentError, "Argument must be a Hash of named queries (#{queries.class} given)"
      end

      stmts       = []
      bind_values = []

      queries.each do |key, args|
        str, *values = @builder.select(*extract_query_data(args))
        stmts.push(str, "SHOW META")
        bind_values.push(*values)
      end

      rs = @conn.multi_query(stmts.join(";\n"), *bind_values)

      Hash[].tap do |result|
        queries.keys.each do |key|
          records, meta = rs.shift, rs.shift
          result[key] = meta_to_hash(meta).tap do |r|
            r[:records] = records.map { |hash|
              hash.inject({}) { |o, (k, v)| o.merge!(k.to_sym => v) }
            }
          end
        end
      end
    end
def multi_search(queries)
      unless queries.kind_of?(Hash)
        raise ArgumentError, "Argument must be a Hash of named queries (#{queries.class} given)"
      end

      stmts       = []
      bind_values = []

      queries.each do |key, args|
        str, *values = @builder.select(*extract_query_data(args))
        stmts.push(str, "SHOW META")
        bind_values.push(*values)
      end

      rs = @conn.multi_query(stmts.join(";\n"), *bind_values)

      Hash[].tap do |result|
        queries.keys.each do |key|
          records, meta = rs.shift, rs.shift
          result[key] = meta_to_hash(meta).tap do |r|
            r[:records] = records.map { |hash|
              hash.inject({}) { |o, (k, v)| o.merge!(k.to_sym => v) }
            }
          end
        end
      end
    end
Perform a a batch search on the index.

 A Hash of queries is passed, whose keys are used to collate the results in
 the return value.

 Each query may either by a string (fulltext search), a Hash (attribute search)
 or an array containing both.  In other words, the same arguments accepted by
 the #search method.

 @example
   index.multi_search(
     cat_results: ["cats", { author_id: 57 }],
     dog_results: ["dogs", { author_id: 57 }]
   )

 @param [Hash] queries
   a hash whose keys map to queries

 @return [Hash]
   a Hash whose keys map 1:1 with the input Hash, each element containing the
   same results as those returned by the #search method.