def match_documents(mind_results, database_results, key = 'id')
      return [] unless database_results
      mind_results.each_with_object([]) do |result, arr|
        next unless (doc = database_results.find { |s| s[key].to_s == result['document_id'].to_s })
        arr << doc.attributes.merge(result)
      end
    end
def match_documents(mind_results, database_results, key = 'id')
      return [] unless database_results
      mind_results.each_with_object([]) do |result, arr|
        next unless (doc = database_results.find { |s| s[key].to_s == result['document_id'].to_s })
        arr << doc.attributes.merge(result)
      end
    end
Takes two result arrays and using the specified key merges the two

 @param [Array] mind_results The results from the API
 @param [Array] database_results The results from the database
 @param [String] key The key of the database_results Hash that should match the mind_results id key
 @return [Hash] An array of merged Hashes