What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

When I type in multiple search terms in the search box I expect to see results each of which contains all of those words and to see the words highlighted in the search results. This is the standard Google has set and pretty much all search engines that I can think of work this way, but apparently not the SO search engine. This makes it very difficult to avoid asking duplicate questions, as the search results are largely irrelevant unless you search for a single specific word.

Case in point, this very question has probably been asked but when I search for the string "search all words", whether with or without quotes, I don't see any relevant results. I get results containing the word "search" and a few of them even contain the word "words", but I can't see any that contains "search" and "all" and "words".

So how do I find relevant results when searching for multiple terms?

Edit: I appreciate people pointing out my mistake about how the Google search works (you learn something new every day!), but the question wasn't actually about the Google search - it was about the Stack Overflow search. The point is that I expect to see results relevant to all the terms I entered, not just some of them, and I don't see those on Stack Overflow. Is it possible to force it to match all the terms?

share|improve this question
    
you said "When I type in multiple search terms in the search box I expect to see results each of which contains all of those words.." please point to me where the word 'tyrannosaurus' appears in the first search result for "tyrannosaurus anti-aircraft gun" –  Jeff Atwood Aug 17 '09 at 11:47
    
OK, so it's not in the first result for some silly reason, but it's in most others. I hope the intent of the question was still clear - how do I find search results containing all of the terms. Feel free to edit the question to clarify this, if needed. –  EMP Aug 17 '09 at 12:30
    
Use Google search for what Google is good for, use SO search for what SO search is good for: meta.stackoverflow.com/search. –  Ladybug Killer Aug 18 '09 at 11:00
6  
Oddly enough, this very page is now appearing as the first search result for "tyrannosaurus anti-aircraft gun". So Google is almost a self-fulfilling prophecy :) –  Chris R. Donnelly Sep 19 '09 at 16:18

6 Answers 6

There is a way to do this, but it's obscure.

Quotes trigger strict matching, like so:

http://stackoverflow.com/search?q=%22perl+array%22

But that strict matching search mode is typically only used for phrases. If you want it in words, you have to use quotes around each word:

http://stackoverflow.com/search?q=%22xts%22%20%22mode%22

compare with results from non-quoted version

http://stackoverflow.com/search?q=xts+mode

I added an alias for this using plus:

http://meta.stackoverflow.com/search

If you want to ensure that the words appear in the results, start them with a plus:

+apples +oranges

share|improve this answer
2  
@JeffAtwood Could you please give the authoritative answer to why SO search defaults to OR rather than AND? This is asked in a number of places and people either answer defensively or give theories and generally don't answer the question. Even your answer to the tyrannosaurus question seems defensive & doesn't answer question. Defaulting to OR certainly goes against the behavior most people have become used to. This is not an attack or a criticism it is just a statement. Can we put this question to bed once and for all? Me and I think others would just like to understand this. Thanks! –  Howie Feb 21 '10 at 0:47
    
@Howie it's a long story; see documentation for technical details of SQL Server full text indexing. –  Jeff Atwood Feb 21 '10 at 8:42
    
@JeffAttwood So it relates to either a limitation in, or a difficulty in implementing with (I assume more likely an implementation difficulty than a limitation) SQL Server full text indexing? As long as it wasn't wasn't a SO design goal. :) –  Howie Feb 24 '10 at 0:54
    
Hurray for that alias! –  Arjan May 2 '10 at 10:02

I had the same problem and have a mediocre workaround. Often when you have multiple word searches one of those words is likely a tag.

So for example if you wanted a search with all the words "vb6 dialog", but not necessarily that phrase, just rework your search as "[vb6] dialog"

You can also extend this to use more than one tag. "[vb6] [vb.net] dialog"

It ain't a perfect solution and only works when some or all of your terms are in the tags of the question you are looking for, but it is better than nothing.

share|improve this answer
    
thanks, the tag search with quotes worked very well –  BlackICE Mar 25 '10 at 13:07

My observations (I'm playing devil's advocate, and trying to represent a newbie, who might not know about searching for answers with specific tag(s)):

Searching for "debug xml serialization" had as its first result (at time of writing) as: .NET XML serialization gotchas, which doesn't contain the term "debug"

Searching for "xml serialization debug" actually performs "[xml] serialization debug"

Questions tagged as [xml-serialization] are extremely poorly represented on the first page of results in either.

share|improve this answer

I think tyrannosaurus anti-aircraft gun is a spurious example.

As others have noted, [other dinosaur] anti-aircraft gun works as expected. It only shows pages that contain all of the terms. Only tyrannosaurus anti-aircraft gun seems to show pages that don't actually contain the word "tyrannosaurus".

Note also that when Google highlights the search results, in some cases it highlights the term "T-rex", a well-known synonym for "Tyrannosaurus rex."

I think what is happening is that Google is taking "T" as a synonym for "Tyrannosaurus." There's a Wikipedia page for "MG 42" that has the letter T in the templates at the bottom of the page. This seems to be sufficient for Google to consider it a match.

What about the YouTube video that's ranked even higher? My guess would be that, "T" being a common term, it's being omitted, and the page is being shown due to its high ranking for anti-aircraft gun.

Google does use AND, not OR, by default. But this can be obscured due to peculiarities such as the above.

(Additionally, Google regards a word as matching if it's used in link text pointing to a page, even if that word doesn't occur on the page itself. You can usually tell if this is the case by looking at the cached version of the page.)

BONUS: For more synonym fun, have a look at Google's top result for

keyup keydown dinosaur
share|improve this answer
    
Wow, my top result for keyup keydown dinosaur at home is different from my top result at work. I'm not sure what to make of that. The top result I was speaking of was this: msdn.microsoft.com/en-us/magazine/dd569752.aspx –  Kyralessa Mar 21 '12 at 0:35
    
I ran across another example today. Try searching on this: poor man's active directory. Google regards ad as a synonym for active directory, meaning I get results for poor man's ad, most of which in fact refer to advertisements. In its quest to be smart, Google is making itself stupid. –  Kyralessa Jun 10 '12 at 21:10

When I type in multiple search terms in the search box I expect to see results each of which contains all of those words ... This is the standard Google has set

are you using a different Google than I am?

http://www.google.com/search?q=tyrannosaurus+anti-aircraft+gun

I sure don't see the word "tyrannosaurus" in any of the first Google search results..

As for quoted phrases, that's valid, of course, but you open with a premise so incorrect that it's hard to get any further.

share|improve this answer
1  
I do. So I guess we are using different Googles shrug. Anyway, the basic question was: how do I find only results that contain all of the search terms. –  EMP Aug 17 '09 at 11:29
    
um, the first result is the wikipedia page en.wikipedia.org/wiki/Anti-aircraft_warfare which does NOT contain the word tyrannosaurus, even though it's plainly visible in my search terms. Your premise of "every word I type should appear" is completely and utterly wrong. –  Jeff Atwood Aug 17 '09 at 11:43
7  
In lieu of just proving Evgeny wrong about Google, could you please at least address his question? Google does provide you a way to search for all terms in your search. If you search for tyrannosaurus and anti-aircraft and gun, you get pages with all of those words in them (4,750 of them. Thank you, Internet). We don't have an and operator, which is not fun, especially when searching for that one post you knew was there somewhere. I know the search isn't competing with Google, but a basic and operator would be shiny. –  Eric Aug 17 '09 at 12:14
1  
Utterly wrong, huh? That's basically how Google works in my experience too: results contain only pages for which all the search terms are relevant (somehow). As for the tyrannosaurus example, I guess someone must be linking to the page using that word, or when Google indexed it, the word appeared somewhere in the comments. –  Jonik Aug 17 '09 at 12:23
    
@Jonik: The default behavior of Google is to actually pull back the most relevant pages for that search term. That does not include a blanket and. Jeff's right in that this is not how Google is designed nor intended to work. Of course, Google's relevancy engine is a little better than StackOverflow's, but hey, they had a head start. –  Eric Aug 17 '09 at 12:25
    
Ignoring the result for this page, the top result was en.wikipedia.org/wiki/List_of_Decepticons Which does have all terms (as does the next result www.freewebs.com/zoideve/DinosaurDragon.htm ) –  Rowland Shaw Aug 18 '09 at 10:04
2  
The test still works with a different dinosaur. I think this is a relatively recent (last couple of years) change in Google's behavior. For a while all terms would appear in the result, then all terms would appear either in the result or in pages linking to it, and now apparently it's just magic. However, "[less common dinosaur] and anti-aircraft and gun" does work. It sure would be nice if it worked on Stack Overflow, because showing me all results relating to dinosaurs when what I want is the handful of results that relate to both dinosaurs and anti-aircraft guns is not very helpful. –  David Moles Sep 24 '09 at 9:32

Google does not apply a blanket and. They have a pretty sophisticated relevancy engine which tells them what results to pull back. Most of the time, results contain all of the words, but they are not guaranteed to.

Instead, you need to use the and operator. So, to search StackOverflow for the words tyrannosaurus anti-aircraft gun and get posts will all of those words, you would search for this on Google:

tyrannosaurus and anti-aircraft and gun site:stackoverflow.com

The and operator makes all of the difference here. Of course, Google tends to pull back SO results better than SO, so unless you're using some of the advanced searching features, use the Google.

share|improve this answer
4  
-1: "Google does not apply a blanket and" Actually, yes it does. "The AND operator, by the way, is the default, so it is not needed." google.com/support/websearch/bin/answer.py?answer=136861 Not only that, but Google only processes boolean operators if you capitalize them. –  Powerlord Sep 17 '09 at 19:55

You must log in to answer this question.

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