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

I was led to believe that -[tag] would do this, but it doesn't appear to.

share|improve this question
1  
There seems to be no way at the moment. See meta.stackoverflow.com/search?q= –  malach Aug 13 '10 at 8:37
    
Even the mighty Google do not support only negative query. But, they do support site: + negative: google.com/#q=site:stackoverflow.com%2Fquestions+-java –  HuBeZa Feb 28 '11 at 8:14
add comment

3 Answers 3

up vote 4 down vote accepted

Tag search functionality is... limited... and completely broken in many complex cases when using the NOT operator.

Your best bet is to keep the search as simple as possible. Most of what you need to know is covered in my bug report here.

To summarize, here are some common cases you might try when doing an advanced search:

  • [tag1] -[tag2] -- works! (it's all downhill from here, so hopefully this is sufficient)

  • -[tag1] -- disallowed because the result set would be too big

  • -[tag2] [tag1] -- disallowed

  • [tag1] -[tag2-~] -- broken -- expands as [tag1] and -[tag2-a] or [tag2-b] or [tag2-c] instead of [tag1] and -([tag2-a] or [tag2-b] or [tag2-c])

  • [tag2-~] -[tag1] -- broken -- expands as [tag2-a] or [tag2-b] or [tag2-c] or -[tag1] instead of ([tag2-a] or [tag2-b] or [tag2-c]) and -[tag1]

  • [tag1] -[tag2] other search terms -- appears to be broken -- looks like the NOT operator is simply ignored

I could swear I had a comment discussion with Jeff about the ~ operator leaking out those ORs, but it was so long ago that I doubt I can find it at this point. He saw what was wrong, but I guess it never got fixed.

Anyhow, with the wildcards, even the erroneous expansions don't seem to produce correct search results... so at this point, don't even bother trying that. Wildcard searches on their own or in combination with other ANDed tags work fine. It's only when the NOT operator is introduced that everything blows up... but that's what you asked for in this question, so there it is.

share|improve this answer
    
I did look at it -- the fix was kind of difficult. Apologies. –  Jeff Atwood Oct 13 '10 at 1:49
    
@Jeff: Okay, as long as you looked at it. Obviously it's not a high-priority bug, but it would be nice to get it fixed. I think the most important one out of the ones I've listed above would be the tags + free text searching with a NOT. –  Jon Seigel Oct 13 '10 at 16:39
add comment

You can, but a query cannot have merely a not clause.

NOT SOMETHING

is disallowed, but

SOMETHING AND NOT OTHER

is allowed

share|improve this answer
1  
So is there something wrong with stackoverflow.com/… , because that doesn't seem to work. –  Bobby Jack Aug 13 '10 at 8:42
    
Anyone know what's wrong with the example in my previous comment? –  Bobby Jack Sep 29 '10 at 12:57
    
@Bobby - Looks like you can only do tags without a search term if you do a not search. ----------- The not search would seem like something that should be in [ the search FAQ ](stackoverflow.com/search). –  Peter Ajtai Oct 13 '10 at 0:38
add comment

You can only do this with tags alone using questions/tagged. You can use the form -tag, in conjunction with another tag: questions/tagged/this+-that

The not functionality will not work in a search, so there's no way to add a search term.

So this will work:

http://stackoverflow.com/questions/tagged/javascript+-html

The above selects all [javascript] that are not [html].

If you try and add a search term it will only look like you're selecting questions that are not in a tag.

For example to try and search "open link new window" in [javascript] but not [html], you can try the following.

This will not work.

http://stackoverflow.com/search?q=[javascript]+[-html]+open+link+new+window

This will take you to a page that says not HTML, but that's not true:

alt text (click to enlarge)


You can try Google with something like:

open link new window +javascript -html site:stackoverflow.com

share|improve this answer
1  
It works if you just search by tags (IE without the "open link in new window"). –  Gelatin Oct 13 '10 at 0:32
    
@Simon - Thanks. Didn't know that. Nice feature. - Though it's not really a search, since it just redirects to questions/tagged. –  Peter Ajtai Oct 13 '10 at 0:51
add comment

You must log in to answer this question.

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