Skip to content
hn

Search and filter

Full-text search with tags, dates, points, and comment counts.

hn search rides the Algolia index, which carries filters the live API does not. The query is the one positional argument; the rest are flags.

hn search "rust"
hn search "postgres performance" -n25

--tags chooses the kind of item. The default is story.

hn search "rust"   --tags story        # stories (default)
hn search "rust"   --tags comment      # comments
hn search "show"   --tags show_hn      # Show HN
hn search "hiring" --tags job          # jobs

Sort by date

The default sort is relevance. Switch to newest-first with --sort date:

hn search "llm" --sort date

Filter by time, points, and comments

hn search "kubernetes" --since 24h        # last day (also 7d, 90m, and so on)
hn search "golang" --points 100           # at least 100 points
hn search "ai" --comments 50              # threads with at least 50 comments

--since understands Go durations (90m, 24h) plus a d suffix for days (7d, 30d).

Comment hits point back to their thread

When a hit is a comment, its record carries the story_id and story_title of the thread it belongs to, so you can jump from a match to its context:

hn search "borrow checker" --tags comment -o jsonl |
  jq -r '"\(.story_title): \(.text)"'

Story hits leave those fields empty, since they would just echo the hit's own id.