def text_stream_search(text_stream, mode='books', weight=HEAVY,
sort_type=nil, page=1, &block)
unless @locale == 'us'
raise LocaleError, "search type invalid in '#{@locale}' locale"
end
url = AWS_PREFIX + "?t=%s&TextStreamSearch=%s&mode=%s&f=xml" +
"&type=%s&dev-t=%s&page=%s"
@type = WEIGHT[weight]
sort_string = get_sort_string(sort_type, mode)
modes = %w[electronics books videogames apparel toys photo
music dvd wireless-phones]
unless modes.include? mode
raise ModeError, "mode must be one of %s" % modes.join(', ')
end
%w[and or not the a an but to for of on at].each do |particle|
text_stream.gsub!(/\b#{particle}\b/, '')
end
text_stream = url_encode(text_stream)
url =
url % [@id, text_stream, mode, @type, @token, page] << sort_string
search(url, &block)
end