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

This is a programming website. It's expected that there will be many keywords that are composed of underscores. Often, the keyword is pretty specific whereas the individual words are not. (For example, the word meta could be for anything while if I'm searching for _meta I'm probably looking for a question about Django records).

Considering how central underscores are to many programming languages, and considering that I can think of few occasions where someone would accidentally type an underscore between two words they were trying to search for, I'm wondering why ignoring underscores seems to be default behavior.

If it's an implementation issue I understand, but for usability I'd rather be told that there were no questions with my underscored keyword, if that is the case, and be given the opportunity to search for the words split out by spaces.

share|improve this question
2  
Unlike other punctuation characters, underscores are frequently used on a single term. Punctuation like dots, colons, and apostrophes generally indicates that there are two terms. Underscores should be (and are, at least in Notepad++ and Visual Studio double-click/ctrl-shift word selection) as one word. –  Kevin Vermeer Nov 16 '11 at 15:42

3 Answers 3

This is now possible with the new search engine!

With the new search engine, underscores are no longer treated as spaces so a search for _meta will indeed return django related posts.


(obsolete answer follows...)

As mentioned in this answer, many many requests have been made to take into account punctuation/operators in searches. Unfortunately, they tend to get close as dupes, marked as or is generally ignored (like this question!).

At one point, jeff mentioned that this could be done by putting the terms in quotes but that doesn't work for me. Things have probably changed since then.


There is still hope...

If all you need is a simple search of specific terms (without filtering by tags or using Advanced Super Ninja Search Options) , you can use your friendly neighbourhood search engine (i.e. Google). For example: Search for "_meta" site:stackoverflow.com.

Update: I've also just discovered SymbolHound (mentioned in this answer) which is a recently launched programmer-oriented search engine that takes symbols into consideration. From a few searches I've attempted it seems to work as advertised, and it looks like content comes mainly from stackoverflow.com (from now?). Example: http://symbolhound.com/?q=class_attribute

share|improve this answer
1  
Also note using quotes restricts the search to "_meta" specifically: stackoverflow.com/search?q=%22_meta%22 –  Nick Craver Jan 7 '13 at 6:59
    
Second link gives me a 404 error... –  user215114 Oct 30 '13 at 17:05

Reflects my sentiment. I just tried to search for 'class_attribute', which is a new declaration in Rails's ActiveSupport. SO insists on treating it as 'class attribute' which will obviously return a large, irrelevant set of results.

share|improve this answer

There is already a large "installed base" of the underscore being used, without the editor necessarily being specific about its importance. So, any 'fix' is going to require some effort to define trees again amongst the endless forest (woods).

We (SO) should support a regex style "\_meta" to allow for search. Then the (default) behavior of treating underscore as whitespace would be quite acceptable.

And then, there is this problem:

This is in italics_, but this is not. (with an \ _ in the middle)

share|improve this answer
    
I'm not at all clear what it is you're saying. What if they just treated _ as if it were any other alphanumeric character. That seems like a straightforward option to me. –  Jordan Reiter Nov 22 '11 at 7:55
    
Never mind, I see now you're talking about its use as a formatting character. I guess people are just going to have to deal with the false positives, which should be few and unlikely. Most of the time, the underscore is going to be between words (which isn't used for Markdown anyway). –  Jordan Reiter Nov 22 '11 at 7:57
    
@David - The underscore as an italics generator, in rendered markdown, isn't distinguishable from the *single asterisk* - both render as a <em> element - And I'm not proposing that we allow searching for HTML elements. I'm suggesting that we should be able to find names like __main and this_variable, which I don't think would be impacted by not converting the underscore to whitespace. –  Kevin Vermeer Nov 22 '11 at 13:03
3  
Your second 'problem' renders as <em>This is in italics_, but this is not.</em>. No problems at all! –  Kevin Vermeer Nov 22 '11 at 13:06

You must log in to answer this question.

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