19

Let's say I want to search for all posts containing a certain word, or maybe not containing a word. Maybe I want to search only under a given tag (or collection of tags), or only for posts by a given user, or only for questions and not answers, or only for posts with scores in a certain range or active in a certain time frame. Are all these things possible?

What are all the tips and tricks for the search facility on this site?

  • 1
    I've just closed SIX older questions as duplicates of this. That's pretty solid evidence for calling this a "frequently asked question". – Rand al'Thor Mar 17 '16 at 14:11
19

First of all, go to the search box in the left-hand side of the topbar:

screenshot highlighting the search box

You can type any word or collection of words into there to get a list of all posts on the SFF site containing all of those words. Putting - before a word will exclude posts containing that word, so e.g. voldemort -dumbledore will give you all posts that mention Voldemort but not Dumbledore. Quotes enable you to search for phrases rather than just collections of words: e.g. "Gandalf the White" will give you all posts containing the phrase "Gandalf the White", not all posts containing those three words somewhere. You can search for URLs linked from within a post by typing url:example.com into the search box.

But probably you know all this already. The interesting bit is how to do more advanced searches. The official page on this is here, but I've rewritten it all below (and wow, did I learn a lot while doing so!) That help page is also linked to from the 'Advanced Search Tips' which you see on the right of every search results page:

screenshot highlighting the link to the advanced search tips

Warning: entering a number into the search bar may give you the post with that number as its post ID rather than a list of all posts containing that number in their text. This applies if and only if the post with that ID is a question. For example, searching for 9331 here on meta will take you back to the question above, but searching for 9332 won't take you to this answer. Whether you want to see this as a bug or a feature is up to you; certainly, it has its uses but can also be annoying.

Wildcard

Include * in a search term to do a wildcard search: e.g. Wooki* will give you all questions containing Wooki, Wookie, Wookiee, or any other possible misspelling.

Tags

To search for questions only in a certain tag, include the tag name in square brackets. E.g. white tower [wheel-of-time] will give you all posts in the tag which mention the White Tower.

To broaden your search to more than one tag, you can use or between tags. E.g. [star-trek-tos] or [star-trek-tng] will give you all posts in either of the two tags , . And as with individual words, adding - before a tag excludes posts in that tag, so e.g. [star-trek] -[star-trek-tos] will give you all questions with the tag but not the tag.

The wildcard search mentioned above can also be very useful here: searching [star-trek-*] will give you all posts in any of the tags , , , , , and so on (I can't even be bothered to list them all!)

You can search only in tags you have marked as 'favourites' by appending intags:mine to your search terms.

Users

You can search for posts only by a given user provided you know their user ID: e.g. user:976 will give you all posts by DVK. If you're searching for your own posts, you don't have to remember your own user ID: user:me will suffice.

You can also search among a user's 'favourited' questions by adding infavorites:976 or infavorites:mine to your search terms.

Types of post

You can search only questions, or only answers, by including is:question or is:answer in your search. Both use their first letter as shorthand: is:q or is:a.

You can narrow down the range for number of votes, views, and (for a question) answers. When a single number is provided, it's assumed to be a minimum. Ranges can be specified as well, either open-ended or closed.

  • score:-1 or score:-1.. will both return posts with a score greater than or equal to -1
  • views:500..1000 or views:500-1000 will return posts with between 500 and 1000 views
  • answers:..3 (for questions only) will return questions with at most 3 answers
  • answers:2..2 will return questions with exactly 2 answers.

You can also search only for posts specifying - or not specifying - certain specific criteria. In each of the following cases, you can put 1 or yes or true after the colon to find posts that do satisfy that criterion, and 0 or no or false to find posts that don't.

  • isaccepted: (for answers only)
  • hascode:
  • hasaccepted: (for questions only)
  • isanswered: (for questions only; only positively-scored answers count)
  • closed: (for questions only)
  • duplicate: (for questions only)
  • migrated: (for questions only)
  • locked:
  • hasnotice:
  • wiki:

Specifying a question-only or answer-only criterion will limit the search to that type of post. Specifying both at the same time will yield no results.

Dates

You can narrow down to specific dates or date ranges for posts, using created: to specify when the posts were created and lastactive: to specify when they were last active (created, edited, etc.).

Dates can be entered in the following formats:

  • Absolute dates, using one, two, or all three of the Y/M/D possibilities. created:2012..2013 searches posts created from January 1, 2012 to December 31, 2013; created:2012 searches posts created from January 1, 2012 to December 31, 2012; created:2012-04..2012-05 searches posts created between April 1, 2012 and May 31, 2012; lastactive:2012-04-03 searches posts which were last active between 12:00 AM on April 3, 2012 and 11:59 PM on April 3, 2012.

  • Relative dates. 1y, 1m, and 1d are shorthand for "last year", "last month", and "yesterday": e.g., if today is 17 March 2016, created:1m searches posts created between 1 February 2016 and 29 February 2016. (Any other number can be substituted for 1.)
    If you want to see all the posts active in the last three months, use lastactive:3m.. On 17 March 2016, that will show posts from 17 December 2015 up to the most recently active. You can close the range as well: lastactive:3m..1m.

Of course, all times are in UTC.

  • If I type "user:me is:answer" in the search box I get 383 results. If I type "user:me is:answer is:accepted" I still get 383 results; needless to say not all of them were accepted. Is this a bug? ("isaccepted" without colon gets 0 results.) – user14111 Mar 23 '16 at 22:01
  • 1
    @user14111 No, the colon comes after isaccepted. If you type user:me is:answer isaccepted:1, you should get 202 results rather than 383. – Rand al'Thor Mar 23 '16 at 22:48
  • If you do a search with the search box, then on the result page the sidebar will have an "Advanced Search Tips" button that shows a handy cheat sheet of all operators. Could you perhaps mention that too in this post? – b_jonas Jul 15 '16 at 9:54
  • @b_jonas I've already linked to that page, which is where I got most of the info in this answer from. – Rand al'Thor Jul 15 '16 at 13:18
  • @Randal'Thor: sure, but it would be useful for users to know about that cheat sheet, because it's quicker to access them then to look in the Help Center. It wasn't obvious to me that there was a cheat sheet. – b_jonas Jul 15 '16 at 13:34
  • @b_jonas OK, edited. – Rand al'Thor Jul 15 '16 at 13:57
  • 1
    @Randal'Thor FYI, your post still starts with "First of all, go to the search box in the top right corner of your window" :) – doppelgreener Apr 11 '18 at 9:40
  • @doppel fixed :-) – Rand al'Thor Apr 11 '18 at 16:04
8

Questions where you could accept an answer

Enter user:me is:question hasaccepted:no answers:1 closed:no into the search box (or click the link).

This searches for

user:me         // posts by you
is:question     // questions
hasaccepted:no  // no answer has been accepted yet
answers:1       // it has at least one answer
closed:no       // not closed

And there you go.

  • 1
    Useful search. Personally I never bother with this and just go through the Questions tab in my profile - but then I'm pretty slow at accepting answers in general :-) – Rand al'Thor Mar 17 '16 at 14:15
  • @randal'thor I've submitted a feature request for a handy link somewhere on your profile for a site-wide overview of questions with answers waiting for acceptance. – SQB Mar 17 '16 at 14:17
  • 1
    Why "closed:no"? I thought you could accept an answer to a closed question, am I wrong? – user14111 Jun 1 '17 at 23:06
3

I attempt to find questions through using the more unusual Potter words: Fudge, instead of Minister; Galleon instead of money (in this instance, money may be better, it depends; Elder Wand instead of "the wand Draco stole from Dumbledore". Etc. The more exotic/specific the word, the more likely it is to pop.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .