Feature Spotlight: Query Rules
You’re running an ecommerce site for an electronics retailer, and you’re seeing in your analytics that users keep ...
Technical Writer
You’re running an ecommerce site for an electronics retailer, and you’re seeing in your analytics that users keep ...
Technical Writer
What do OpenAI and DeepMind have in common? Give up? These innovative organizations both utilize technology known as transformer models ...
Sr. SEO Web Digital Marketing Manager
As a successful in-store boutique manager in 1994, you might have had your merchandisers adorn your street-facing storefront ...
Search and Discovery writer
At Algolia, our business is more than search and discovery, it’s the continuous improvement of site search. If you ...
JavaScript Library Developer
Analytics brings math and data into the otherwise very subjective world of ecommerce. It helps companies quantify how well their ...
Technical Writer
Amid all the momentous developments in the generative AI data space, are you a data scientist struggling to make sense ...
Sr. SEO Web Digital Marketing Manager
Fashion ideas for guest aunt informal summer wedding Funny movie to get my bored high-schoolers off their addictive gaming ...
Sr. SEO Web Digital Marketing Manager
Imagine you're visiting an online art gallery and a specific painting catches your eye. You'd like to find ...
Senior Software Engineer
At Algolia, our commitment to making a positive impact extends far beyond the digital landscape. We believe in the power ...
Senior Manager, People Success
In today’s post-pandemic-yet-still-super-competitive retail landscape, gaining, keeping, and converting ecommerce customers is no easy ...
Sr. SEO Web Digital Marketing Manager
There are few atmospheres as unique as that of a conference exhibit hall: the air always filled with an indescribable ...
Marketing Content Manager
To consider the question of what vectors are, it helps to be a mathematician, or at least someone who’s ...
Search and Discovery writer
My first foray into programming was writing Python on a Raspberry Pi to flicker some LED lights — it wasn’t ...
Technical Writer
How well do you know the world of modern ecommerce? With retail ecommerce sales having exceeded $5.7 trillion worldwide ...
Sr. SEO Web Digital Marketing Manager
In a world of artificial intelligence (AI), data serves as the foundation for machine learning (ML) models to identify trends ...
Director of AI Engineering
Imagine you’re a leading healthcare provider that performs extensive data collection as part of your patient management. You’re ...
Search and Discovery writer
In an era where customer experience reigns supreme, achieving digital excellence is a worthy goal for retail leaders. But what ...
Marketing Content Manager
Just a few years ago it would have required considerable resources to build a new AI service from scratch. Of ...
VP, Engineering
We are Hacker News readers and probably just like you, there is not a day that goes by we don’t use it. It is a little like checking the weather app of the tech world. Long story short, Hacker News is awesome, and we wanted to add our two cents to make it even greater to use.
Indeed, here is our problem: how do we instantly access the old posts we wish we had saved?
Up until now we’ve been using hnsearch.com, maintained for years by the great folks at Octopart. I hope we speak on behalf of the HN community here, we are all grateful for the work they put in hnsearch.com and they inspired us to pursue their effort.
Back in September 2013, we created a “homemade Hacker News crawler” and built a search engine with the data we could get. It was not perfect but somehow, it did the job fine.
Now part of the Ycombinator W14 batch, we have a direct access to the data and it has allowed us to provide instant search for the entire content of Hacker News, 1.2 million articles, 5.2 million comments as of today. See for yourself right here: hn.algolia.com
# Yep, that's a Lisp API :) EXPORT_REGEXP = %r{^((d+) (story|comment|poll|pollopt) "(.+)" (d+) (?:nil|"(.*)") (?:nil|"(.+)") (?:nil|"(.*)") (?:nil|-?(d+)) (?:nil|(([d ]+))) (?:nil|(d+)))$}
(timeout 60 xvfb-run --auto-servernum --server-args="-screen 0, 1024x768x24" wkhtmltoimage-amd64 --height 768 --use-xserver--javascript-delay 30000 "$URL" "$FILE" || timeout 60 xvfb-run --auto-servernum --server-args="-screen 0, 1024x768x24" wkhtmltoimage-amd64 --height 768 --use-xserver --disable-javascript "$URL" "$FILE") && convert "$FILE" -resize '100!x100' "$FILE"
AWS::S3::S3Object.store("#{id}.png", open(temp_file), 'hnsearch', access: :public_read)
class Item < ActiveRecord::Base include AlgoliaSearch algoliasearch per_environment: true do # the list of attributes sent to Algolia's API attribute :created_at, :title, :url, :author, :points, :story_text, :comment_text, :author, :num_comments, :story_id, :story_title, :story_url attribute :created_at_i do created_at.to_i end # The order of the attributes sets their respective importance. # `title` is more important than `{story,comment}_text`, `{story,comment}_text` more than `url`, `url` more than `author` # btw, do not take into account position to avoid first word match boost attributesToIndex ['unordered(title)', 'unordered(story_text)', 'unordered(comment_text)', 'unordered(url)', 'author', 'created_at_i'] # add tags used for filtering tags do [item_type, "author_#{author}", "story_#{story_id}"] end # Custom ranking allows to automatically sort the results by a custom criteria # in this case, a decreasing sort of the number of HN points and comments. customRanking ['desc(points)', 'desc(num_comments)'] # controls the way results are sorted sorting on the following 4 criteria (one after another) # I removed the 'exact' match critera (improve 1-words query relevance, doesn't fit HNSearch needs) ranking ['typo', 'proximity', 'attribute', 'custom'] # google+, $1.5M raises, C#: we love you separatorsToIndex '+#$' end def story_text item_type_cd != Item.comment ? text : nil end def story_title comment? && story ? story.title : nil end def story_url comment? && story ? story.url : nil end def comment_text comment? ? text : nil end def comment? item_type_cd == Item.comment end def num_comments item_type_cd == Item.story ? story_comments.count : nil end end
There is still room for improvement and we would love to know how you are searching for news on HN. What is important for you? Are you searching by date, by upvote, by comment or by user? All together maybe?
We would love to have your feedback! Don’t hesitate to checkout the code: We open-sourced it.
Special thanks to the Octopart and YC teams for making this experience possible!
Give it a try now: hn.algolia.com
Powered by Algolia Recommend