# File lib/amazon/search/exchange/marketplace.rb, line 81
          def keyword_search(seller_id, keyword, weight=HEAVY,
                             keyword_search=nil, browse_id=nil, zipcode=nil,
                             area_id=nil, geo=nil, sort=nil, index=nil, &block)
            
            url = AWS_PREFIX + "?t=%s&MarketplaceSearch=keyword&f=xml" +
                  "&type=%s&dev-t=%s&keyword=%s&seller-id=%s"

            type = WEIGHT[weight]
            keyword = url_encode(keyword)

            unless keyword_search.nil?
              if keyword_search_types.include? keyword_search
                url << "&keyword-search=" << keyword_search
              else
                raise KeywordSearchError,
                  "'keyword_search' must be one of %s" %
                    keyword_search_types.join(', ')
              end
            end

            url << "&browse-id=" << browse_id unless browse_id.nil?

            unless zipcode.nil?
              if zipcode !~ /^\d{5}$/
                raise ZipcodeError, "'zipcode' must be 5 digits"
              end
              url << "&zipcode=" << zipcode
            end

            unless area_id.nil? && geo.nil?
              if geo.nil?
                raise GeoError,
                  "'geo' must be specified in combination with 'area_id'"
              elsif area_id.nil?
                raise AreaIdError,
                  "'area_id' must be specified in combination with 'geo'"
              elsif area_id !~ /^4000\d\d\d$/
                raise AreaIdError, "area code not well formed"
              elsif ! geo_types.include? geo
                raise GeoError, "'geo' must be one of %s" %
                                geo_types.join(', ')
              end

              url << "&area-id=%s&geo=%s" % [area_id, geo]
            end

            unless index.nil?
              if index_types.include? index
                url << "&index=" << index
              else
                raise IndexError,
                  "'index' must be one of %s" % index_types.join(', ')
              end
            end

            url = url % [@id, type, @token, keyword, seller_id]

            unless sort.nil?
              if sort_types.include? sort
                url << "&sort=" << sort
              else
                raise SortError,
                  "'sort' must be one of %s" % sort_types.join(', ')
              end
            end

            search(url, &block)
          end