On the Search Help/FAQ page, it says you can narrow your search to specific tags: tag search options

However, when I run searches with multiple tags, I frequently get extra, erroneous results.
For example see this search for [greasemonkey] [iframe] user:331508:

(Click for larger image)
search results

The searches are returning way too many results and the top results don't even have one of the required tags!

Note, as pointed out in the comments, this is OR behavior, contrary to what the Help/Faq implies.

I have tried every variation of: AND, [AND], and + that I can think of. The search still returns incorrect results.

  • Lol, it exhibits [OR] behavior here.
    – nhahtdh
    Commented Sep 4, 2012 at 2:40
  • 2
    Wonder if the user parameter breaks it back into OR
    – random
    Commented Sep 4, 2012 at 2:50
  • 2
    Yeah, this is only happening for me when combined with the user operator.
    – animuson StaffMod
    Commented Sep 4, 2012 at 2:59
  • Yes, I could have swore that other parameters would break it too but, so far, only user: does so reliably. Commented Sep 4, 2012 at 3:14
  • I'm pretty sure this is a duplicate question but haven't attempted to locate one. IIRC Something about it is broken if anything is included in the search other than tags.
    – Mark Hurd
    Commented Sep 4, 2012 at 6:04

1 Answer 1


This will be fixed in the next build. A shortcut is used direct against SQL for these types of searches that ends up, by nature, being inaccurate and OR-ing the tags.

It boils down to this:

And Exists(Select 1 
             From PostTags pt 
            Where p.Id = pt.PostId 
              And pt.TagId in (@tagIds1, @tagIds2, @tagIds3)) 

That means we get an effective OR in our search, and it's a very non-trivial thing to change as that's used in many code paths. Instead of going that route, we'll submit more-than-one tag searches to Lucene and exactly 1 to SQL. The 1 case is especially important performance-wise because it's what you get when clicking a tag from a user's profile...so it's quite common and worth optimizing.

You must log in to answer this question.

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