Module: HackerNewsSearch::Client::Search
- Included in:
- HackerNewsSearch::Client
- Defined in:
- lib/hacker_news_search/client/search.rb
Instance Method Summary collapse
-
#hotness(options = {}) ⇒ Hash
Returns the top 30 hot stories based on the Hacker News Search algorithm.
-
#search(collection, query, options = {}) ⇒ Hash
Returns the information based on the search criteria.
Instance Method Details
#hotness(options = {}) ⇒ Hash
Returns the top 30 hot stories based on the Hacker News Search algorithm
27 28 29 |
# File 'lib/hacker_news_search/client/search.rb', line 27 def hotness(={}) get("items/_search?limit=30&sortby=product(points,pow(2,div(div(ms(create_ts,NOW),3600000),72)))%20desc", ) end |
#search(collection, query, options = {}) ⇒ Hash
Returns the information based on the search criteria
16 17 18 |
# File 'lib/hacker_news_search/client/search.rb', line 16 def search(collection, query, ={}) get("#{collection}/_search?q=#{query}", ) end |