Trying to find some of my old answers on SO I did not get the results I expected.
(The problem seems to apply all SE sites. I tested dba.SE and superuser, same problem.)
The "Advanced Search Tips" advertise:

exact "words here"

No mention this would exclude code. Nothing 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 4 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 key word 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 StackExchange 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 StackExchange 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.

  • 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
  • @TimPost: Did that person have ideas how to fix the search? – Erwin Brandstetter Dec 7 '18 at 22:53

You must log in to answer this question.

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