I tried to find some of my old answers on Stack Overflow but did not get the results I expected. The problem seems to apply all SE sites. I tested dba.SE and Super User, and they exhibit the same problem.

The "Advanced Search Tips" advertise:

exact "words here"

There is isn't any mention this would exclude code. Nothing is mentioned in the help page, either.

This related post explicitly claims it should work for code or symbols:

Quoted phrases are exact matches except for case-sensitivity, for example, you can search for code or symbols.

But that does not seem to work as advertised.

user:939860 "WITH RECURSIVE" returns four results (the phrase appears outside code blocks).

user:939860 WITH RECURSIVE (no double quotes) returns 108 results - obviously ignoring the noise word "with". Most of the results have the exact phrase WITH RECURSIVE - inside code blocks.

This does the job, mostly:

user:939860 code:"WITH RECURSIVE"


  • The keyword code: seems to be a secret, neither mentioned in the "Advanced Search Tips" nor on the help page.

  • Now I get only code results. The attempt to use OR does not work: user:939860 code:"WITH RECURSIVE" OR "WITH RECURSIVE"

  • The more useful default would be to search in all text including code to begin with. It is counter-intuitive that code is excluded. After all, that seems to be the behavior with plain words (not phrases). Example: user:939860 RECURSIVE. That includes code and non-code by default.

Is phrase search broken in this respect or am I missing something?


Potential explanations:

  • Why isn't it (code:) documented? Obviously, it should be. I assume it was not a high priority for venture capitalists eyeing this site for a juicy acquisition. Years after this was pointed out, the closest to getting this resolved that we came was an Arbitration Clause.

  • Useful defaults on Stack Exchange search I also agree, it doesn't make much sense to exclude code blocks from the search feature on a network so centered around code blocks. However, there is a valid explanation for this. Currently Stack Exchange pays for an outdated, obscure, and inefficient database named "SQL Server" which is produced by Microsoft. I assume they do this only because everywhere they most oppose freedom and openness, and thus can't use superior technology like PostgreSQL. Also, Jeff Atwood is an ex-Microsoft employee, and Microsoft does pay commissions.... Microsoft SQL Server has no good solution for doing a search on an un-anchored search pattern, and currently Microsoft is too busy marketing a newer version of MS Paint to be bothered to improve their RDBMS.

I'm not sure any of these speculations are accurate, but I just go where the data takes me.

| improve this answer | |
  • 6
    I like paint. I make pictures. Pictures are pretty. So are bunnies. But I think the hiccup in this particular feature is actually in elastic. This is the third time this has come up this month so I'm gonna go do some science and ask the person that actually maintains it. – Tim Post Nov 21 '18 at 17:19
  • 1
    @TimPost: Did that person have ideas how to fix the search? – Erwin Brandstetter Dec 7 '18 at 22:53
  • Jeff Atwood is not an ex-Microsoft employee. Joel Spolsky is. – P.Mort. - forgot Clay Shirky_q Apr 28 at 1:02

You must log in to answer this question.

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