How to search for posts within a timeframe


(Sam Saffron) #1

Sometimes you may want to scope searches to a subset or range of dates. Our search interface supports before and after search clauses. They accept a full date, name of month or day of week.

Examples:

  • before:june hashtag - Posts with the search term hashtag posted before last June

  • before:2014 category:bug order:latest - Posts in the bug category created prior to 2014

  • after:friday broken - Posts created after last Friday with the word broken in them

  • after:2016-01-12 before:2016-01-20 happy - Posts created after 12th of Jan 2016 and before 20th of Jan 2016 with the word happy

  • after:june before:july in:first composer - Searches the first post in topic created from last June for the word composer

  • after:10 before:8 thing - Posts containing the word thing that were posted between 8 and 10 days ago.

All dates are in UTC, we always use beginning of day UTC as the start time for any period.

Note: we deprecated min_age and max_age clauses which were causing confusion. The new filter applies to created_at date of posts, not to the date a topic is created. If you need to filter on topic creation use in:first


min_age / max_age filter not working correctly
#2

I’m looking forward to trying out some of these new search options. I didn’t realize what in:first was before now, that one is going to come in handy too.

I’m one of the people that felt that min_age and max_age were backwards.

My brain would expect to get posts older than 10 days (after:10) and newer than 8 days (before:8) from that search – could be I have some cross-wiring in there. :slight_smile:


(Sam Saffron) #3

:slight_smile:

The before:8 translates to before 8 days ago.
After 10 means after 10 days ago

Those permutations are a bit odd and mind bending, but you can easily avoid them by plugging in dates :sweat_smile:


(Jay Pfaffman) #4

This is great! I would love it if there were some way to search against the local timezone rather than UTC. Being able to specify a time of day would be another way to solve that.

Like @AlbionsRefuge, I was totally psyched when I figured out in:first.


(Rene Groeschke) #5

This is indeed bending my mind a bit. But I can get used to it I guess. Thanks a lot for the prompt work on this.