<commit_before>module HackerNewsSearch
  class Client
    module Search
      
      # Returns the information based on the search criteria
      #
      # @param collection [String] collection is either -  users or items 
      # @param options [Hash] A customizable set of options. 
      # @return {Hash}
      # @see http://www.hnsearch.com/api
      # @see http://www.thriftdb.com/documentation/rest-api/search-api
      # @example
      #   HackerNewsSearch.search("users" {:q => "sferik"})
      def search(collection, options={})
        get("#{collection}/_search", options)
      end
      
      # Returns the top 30 hot stories based on the Hacker News Search algorithm
      # 
      # @param options [Hash] A customizable set of options. 
      # @return {Hash}
      # @see http://www.hnsearch.com/api
      # @example
      #   HackerNewsSearch.hotness
      def hotness(options={})
        get("items/_search?limit=30&sortby=product(points,pow(2,div(div(ms(create_ts,NOW),3600000),72)))%20desc", options)
      end
    end
  end
end<commit_msg>Refactored search to take a query paramater for search q=<commit_after>module HackerNewsSearch
  class Client
    module Search
      
      # Returns the information based on the search criteria
      #
      # @param collection [String] collection is either -  users or items 
      # @param options [Hash] A customizable set of options. 
      # @return {Hash}
      # @see http://www.hnsearch.com/api
      # @see http://www.thriftdb.com/documentation/rest-api/search-api
      # @example
      #   HackerNewsSearch.search("users" "sferik")
      #   HackerNewsSearch.search("users", "sferik" {:limit => "30"})
      def search(collection, query, options={})
        get("#{collection}/_search?q=#{query}", options)
      end
      
      # Returns the top 30 hot stories based on the Hacker News Search algorithm
      # 
      # @param options [Hash] A customizable set of options. 
      # @return {Hash}
      # @see http://www.hnsearch.com/api
      # @example
      #   HackerNewsSearch.hotness
      def hotness(options={})
        get("items/_search?limit=30&sortby=product(points,pow(2,div(div(ms(create_ts,NOW),3600000),72)))%20desc", options)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11754229741763135, 'fraction_numerical': 0.015138023152270703, 'mean_word_length': 2.647727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '808841', 'n_tokens_mistral': 699, 'n_tokens_neox': 663, 'n_words': 176}