Skip to content

Instantly share code, notes, and snippets.

@douira
Last active August 9, 2021 22:28
Show Gist options
  • Save douira/c2d158f76d41b931787c17d23ea0bb58 to your computer and use it in GitHub Desktop.
Save douira/c2d158f76d41b931787c17d23ea0bb58 to your computer and use it in GitHub Desktop.
Fixed version of the reddit search information document

Copy of https://www.reddit.com/wiki/search?v=bb181eaa-0883-11e5-8266-0e4f7a178b4b

reddit search

reddit search allows you to search for submissions and subreddits.

Submissions

The search page for submissions is at http://www.reddit.com/search. You can also search from the sidebar of most reddit pages.

Searching from a specific section of reddit — such as a subreddit, personal multireddit, or temporary multireddit — can limit your search results to that section.

Submission fields

You can search for these parts of a submission:

You can search multiple fields at once.
For example, title:'cats' site:'imgur'

Boolean Operators

reddit search supports the boolean operators + (AND), | (OR), and - (NOT) .

  • If you separate search terms with + (AND) or a space, search finds submissions that contain all of the specified search terms.
    For example, 'cats+mice' or 'cats AND mice'
  • You can use the | (OR) operator to separate terms when you want to match submissions that contain either the preceding term(s) or the following term(s).
    For example, 'cats|mice' or 'cats OR mice'
  • You can exclude terms with the - (NOT) symbol.
    For example, 'cats -mice' or 'cats NOT mice'
  • You can use parentheses to group parts of a search together.
    For example, ['(cats|dogs)+bed'](/search?q=(cats|dogs)+%2B+bed) or ['(cats OR dogs) AND bed'](/search?q=(cats OR dog)+AND+bed)

Wildcard searches

You can use the * (asterisk) wildcard operator to perform prefix matching. The * operator can only be used in conjunction with a search term, by appending to a string. Search matches results that contain the prefix followed by zero or more characters.

For example, redd*

Cloudsearch Syntax

This is a much more advanced and technical search and is detailed below for who are interested or might need it, normally the above techniques (called Lucene syntax) will be enough to find what you would like.

Amazon Cloudsearch Syntax allows very advanced search queries. For programmers and advanced users who want to dig deeper you can find a complete description in the Developer's Guide at Amazon and see how reddit constructs search queries into cloudsearch syntax in the common.py file on github.

You'll see your query converted to this syntax when you mouse over the "δ" icon near upper right of the search box. It will show you something like the following converted query to cloudsearch syntax: (and (field title 'party') (field text 'beatles'))

When invoked manually its most common use is to return searches between two time periods using unix timestamps. You can transform the beginning and end date & time of the period you wish to search into unix timestamps using this website: http://www.epochconverter.com/ . The format goes as timestamp:1373932800..1474019200 where the first is the beginning of the time period, and the 2nd number is the ending time period. Those unix time stamps will return results from between Jul 16,2013 and Sep,16,2016. After doing your search you must put &syntax=cloudsearch in the address bar at the end of the url and hit return in order to enable this feature, as it is disabled by default.

More usage scenarios and examples in the context of reddit can be found in this post

To see it in action here is a link that searches /r/MusicGuides between July 04,2013 & July 05,2013 timestamp:1372982400..1373068800
Notice the &syntax=cloudsearch at the end of the url which enables the timestamp searching feature.

And here is a similar query for between July 04,2013 & July 05,2016 but only searches for those results that have "music" in the title (and timestamp:1373932800..1474019200 title:'music').
Cloudsearch syntax requires the terms to be in parenthesis have the and at the beginning inside.

Tip: Since search results are limited to 1000 results, you can divide your query into different time periods to get past this limit using Cloudsearch Syntax.

Limitations and caveats

  • Search terms may be stemmed. A search for "dogs" may return results with the word "dog" in them.
  • Search results are limited to 1000 results.
  • Searching for phrases doesn't seem to work.
  • Bug: When searching for a word that includes a symbol, it will get split into multiple words without the symbol. As a result, there may be many extraneous search results returned.
  • Bug: author:user-name searches, where the username includes a - (dash) character, do not work, as it's interpreted as "user NOT name" rather than "user-name"

Subreddits

You can search for subreddits at http://www.reddit.com/subreddits/search.

Please direct any questions about search to /r/help.

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