lib/chatterbot/search.rb
def search(queries, opts = {}, &block)
      debug "check for tweets since #{since_id}"
      
      max_tweets = opts.delete(:limit) || MAX_SEARCH_TWEETS
      exact_match = if opts.key?(:exact)
                      opts.delete(:exact)
                    else
                      true
                    end
        
      
      if queries.is_a?(String)
        queries = [
          queries
        ]
      end

      query = queries.map { |q|
        if exact_match == true
          q = wrap_search_query(q)
        end

        q
      }.join(" OR ")
      
      #
      # search twitter
      #

      debug "search: #{query} #{default_opts.merge(opts)}"
      @current_tweet = nil

      client.search( query, default_opts.merge(opts) ).take(max_tweets).each { |s|
        update_since_id(s)
        debug s.text

        if block_given? && valid_tweet?(s)
          @current_tweet = s
          yield s
        end
      }
      @current_tweet = nil

    end
def search(queries, opts = {}, &block)
      debug "check for tweets since #{since_id}"
      
      max_tweets = opts.delete(:limit) || MAX_SEARCH_TWEETS
      exact_match = if opts.key?(:exact)
                      opts.delete(:exact)
                    else
                      true
                    end
        
      
      if queries.is_a?(String)
        queries = [
          queries
        ]
      end

      query = queries.map { |q|
        if exact_match == true
          q = wrap_search_query(q)
        end

        q
      }.join(" OR ")
      
      #
      # search twitter
      #

      debug "search: #{query} #{default_opts.merge(opts)}"
      @current_tweet = nil

      client.search( query, default_opts.merge(opts) ).take(max_tweets).each { |s|
        update_since_id(s)
        debug s.text

        if block_given? && valid_tweet?(s)
          @current_tweet = s
          yield s
        end
      }
      @current_tweet = nil

    end
internal search code