Simple question really - the default search-method here is OR - ie a search for "apples oranges" will show posts that have either apples or oranges or both. I want to show only posts that have both apples and oranges in them.

I tried "apples and oranges" but that returns the same as "apples oranges".

Surely there's a way to do exclusive search sets without resorting to the google-search?

  • This question would be better asked in meta.stackoverflow.com
    – Gordon
    Feb 25, 2010 at 10:18
  • You should ask it in Meta StackOverFlow
    – Faruz
    Feb 25, 2010 at 10:18
  • Cool - yes I realised this too late. I noticed some questions are 'moved' over there - is there a mechanism for that?
    – Taryn East
    Feb 25, 2010 at 10:27
  • Duplicate - meta.stackexchange.com/questions/22388/…
    – ChrisF Mod
    Feb 25, 2010 at 11:01
  • ChrisF - it is not quite a duplicate. The two matters are related, but my question is distinct. The other question asks why the 'OR" search is there by default - the fact that my answer can be found there is by side-effect... :)
    – Taryn East
    Mar 1, 2010 at 11:32

1 Answer 1


Using a + before a search term means it must be included in the results, so the following produces a boolean AND search:

+apples +oranges

(this also works on quoted phrases, optional ninja options, etc.)

You can test it out here

Why don't we do AND by default?

Well, we use OR searches by default and sort by relevance...so effectively you see AND results before OR results in the results that come up. Compare the results above to the OR version you get by default, see how the first results are the same? That's because something with both terms is simply more relevant than anything that has just one. So effectively (at least on the relevance sort), AND is a subset of OR, and it'd just be cutting the result list off at whatever the AND endpoint is...we'd rather give you all the relevant results and stick the stuff that may not be as matchy at the end.

  • Great answer here. However a I recall (it was a while back) the results weren't the same. Try "ruby rails" vs "+ruby +rails" and the first results are actually sorted differently. I don't know why, because your answer about relevance makes sense...
    – Taryn East
    Aug 22, 2011 at 8:18
  • 1
    this is now out of date: meta.stackexchange.com/questions/160100/… (yes I know it's your own post) Dec 29, 2021 at 14:07

You must log in to answer this question.

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