Skip to content

feat(search): add tag, author, URL, date window and page filters - #6

Merged
voska merged 3 commits into
voska:masterfrom
shbernal:feat/search-filters
Nov 3, 2026
Merged

voska merged 3 commits into
voska:masterfrom
shbernal:feat/search-filters

Conversation

@shbernal

Copy link
Copy Markdown
Contributor

hn search reached keywords, a start date and a points floor. Everything else meant raw API calls, even though Algolia supports it. This adds:

  • --tag: show_hn, ask_hn, front_page
  • --by USERNAME
  • --before DATE, so a date range works
  • --url, which matches story URLs only. github.com/voska gives 27 hits this way and 57 without it
  • --page

The query is now optional, so hn search --tag show_hn --min-points 100 --sort date browses with filters alone. That also covers most of #1.

--min-points N now includes N. It sent points>N, which contradicted the flag's name.

Result counts without a query are Algolia estimates. --tag show_hn reported about 2M with relevance sort and 514k with --sort date, but the hits I sampled were all Show HN posts.

Checked with make test, golangci-lint, and live runs of each README example.

The Algolia API supports all of these, but `hn search` could only reach
keywords, a start date and a points floor. Agents had to drop to raw API
calls for common questions such as "what did this person say about X" or
"has this URL been discussed".

The query becomes optional so filters alone can browse. `--min-points N`
now includes N, as its name says.
@voska

voska commented Oct 30, 2026

Copy link
Copy Markdown
Owner

These all map straight onto filters Algolia already supports, so they cost almost nothing to carry. Making the query optional turns hn search into a real browser, and points>= is the correct reading of --min-points.

One edge worth knowing: --tag is ANDed with story or comment, so --comments --tag show_hn comes back empty because comments don't carry the show_hn tag. Not a blocker.

@voska
voska merged commit d25fc80 into voska:master Nov 3, 2026
2 checks passed
@voska

voska commented Nov 5, 2026

Copy link
Copy Markdown
Owner

This shipped in v0.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants