<commit_before>class MwsClient
  def initialize
    @client = MWS::Products::Client.new
  end

  def search(query_string)
    results = @client.list_matching_products(query_string).parse
    products = results["Products"]["Product"] if results["Products"]
    return unless products
    products.map {|product| parse_product(product)}
  end
<commit_msg>fix bug for only one search result<commit_after>class MwsClient
  def initialize
    @client = MWS::Products::Client.new
  end

  def search(query_string)
    results = @client.list_matching_products(query_string).parse
    products = results["Products"]["Product"] if results["Products"]
    return unless products
    return [parse_product(products)] if products.class != Array
    products.map {|product| parse_product(product)}
  end

{'fraction_non_alphanumeric': 0.10493046776232617, 'fraction_numerical': 0.0, 'mean_word_length': 4.91044776119403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1843781', 'n_tokens_mistral': 229, 'n_tokens_neox': 222, 'n_words': 55}