Could we get the -[tag] and -word usage documented on the search tips page?

As Tim notes in the comments, it appears the "-" operator doesn't work for words, just tags. (Is there a reason for this? Is it too expensive an operation?) (See Nick's answer.)

I also propose that we give some sort of warning when -word is used in a search, like:

The minus operator can only be used with tags. Did you mean to type -[word]?

Below is the original version of this post.

At the time I posted this, the search [ndk] -[android] -[android-ndk] -android returned no results, despite the fact that this question was tagged [c++] [cocos2d-iphone] [cygwin] [ndk] [rtti] and did not mention "android" anywhere, nor did its answer. This question should therefore have shown up in the search results, right?

isn't a special Android tag with the little green icon, unlike , so this behavior is unexpected to me. Is it because mentions Android in its wiki?

Related: Merge [ndk] into [android-ndk] and blacklist the former one

  • 1
    It's because search thinks you want posts tagged ndk, not tagged android or android-ndk, and with the literal text "-android", although it's probably ignoring the hyphen and looking for "android" directly, which, as you've mentioned, that post doesn't contain. Hmm, does the - operator even work for non-tags?
    – Tim Stone
    Commented Nov 24, 2011 at 20:08
  • @TimStone Hmm, thanks for the tip. -"android" doesn't seem to help. - appears to be undocumented in the first place, so I suppose I should be grateful it even works for tags :P
    – user154510
    Commented Nov 24, 2011 at 20:10
  • I think it does work with text, just perhaps not if tags are also present? (In which case it seems to be looking for the literal text "-term")
    – Tim Stone
    Commented Nov 24, 2011 at 20:30
  • @TimStone Well that is just unhelpful. Hopefully someone from SE clarifies.
    – user154510
    Commented Nov 24, 2011 at 20:32

1 Answer 1


"The minus operator can only be used with tags" isn't accurate, the - operator works on text terms as well, it's just not working in this case.

The reason you're getting no results here is you can't search for only the absence of a word. If you were something for something and not nothing, then you'd get a result, for example:

We can look into supporting this, but it's not a trivial change due to how tags are worked in here (they're handled separately to some degree). Lucene currently sees your search as only the absence of a term, not even recognizing that there is some restriction (the tags) in place narrowing the result set. I'll see what we can do here.

  • Ahhh, of course. That makes much more sense, thanks for the clarification!
    – Tim Stone
    Commented Nov 25, 2011 at 14:18
  • That's cool. I'm fine with how it works (though thanks for looking into it, that would be even better), but can we get that spelled out on the search page?
    – user154510
    Commented Nov 25, 2011 at 18:01

You must log in to answer this question.