TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: algorithm used in Hacker News, that determines the front page news

2 pointsby coderhsover 12 years ago
Whats the algorithm used in Hacker News, that determines which post gets to the front page.

3 comments

zio99over 12 years ago
Gravity.<p>Score decreases over time, so interesting news bubble up, and older/no-longer-relevant news gradually decline.<p><pre><code> (= gravity* 1.8 timebase* 120 front-threshold* 1 nourl-factor* .4 lightweight-factor* .17 gag-factor* .1) (def frontpage-rank (s (o scorefn realscore) (o gravity gravity*)) (* (/ (let base (- (scorefn s) 1) (if (&#62; base 0) (expt base .8) base)) (expt (/ (+ (item-age s) timebase*) 60) gravity)) (if (no (in s!type 'story 'poll)) .8 (blank s!url) nourl-factor* (mem 'bury s!keys) .001 (* (contro-factor s) (if (mem 'gag s!keys) gag-factor* (lightweight s) lightweight-factor* 1)))))</code></pre>
评论 #4824948 未加载
pizzaover 12 years ago
direct copy from <a href="http://news.ycombinator.com/item?id=4746566" rel="nofollow">http://news.ycombinator.com/item?id=4746566</a><p>According to the link in dmgrow's comment, it's<p><pre><code> Score = (P-1) / (T+2)^G </code></pre> where P is the number of votes, T is the time in hours since submission, and G is a power that controls the steepness/rate of decline in ranking, so popularity is decreases exponentially over time. I'm sure that YC-affiliated posts have a different ranking algorithm, considering you can't vote on them.<p>Some other cool algorithms are:<p>del.icio.us / delicious.com 's: ranked by upvotes in the last hour. I like the elegance of this solution a lot :)<p>reddit's "best" feature: compares the rates at which comments are upvoted to generate the probability that a comment is a good one, which is how posts with fewer votes can be ranked better than posts with more votes. It works well, in my opinion.
bravoyankeeover 12 years ago
I think there's more to it than what the other two comments described. No doubt there is human moderation on HN (beyond users flagging submissions I mean), and maybe a list of domains and keywords to keep some stories from ever hitting front page, even when the submission gets a lot of votes in a short amount of time.<p>Who knows what the reasons why they'd keep a story off the front page. The moderation is emo at times, even resorting to hellbanning, slowbanning etc.<p>Slashdot moderation is way better. It's a better overall system over there.