11

Update:

Given that this question got 10+ upvotes, a few different answers, and took over 2 days to be identified as a duplicate, makes me think that this information should be added to the How to Search page. When I come on this site looking to post answers, I know I'm only qualified to do so on a few topics, so it's imperative that I limit the questions I look at to only a few tags. I imagine most others do the same and would benefit from finding this information in an obvious place (like the help/search page) rather than buried as a question like any other on the site.


Original Post:

I want to search tags [x] or [y] or [z] but not [a] and not [b].

Yes, I have seen this.

But I'm still getting results with [a]. What am I doing wrong?

enter image description here

3
  • 2
    Just tried your search and ggplot2 also shows up in the results, neither is excluded. Smells like a good bug.
    – Davy M
    Aug 27, 2018 at 23:54
  • Really glad to hear that. I thought I was losing my mind!
    – DanY
    Aug 28, 2018 at 0:05
  • I tried the query in the linked question, and the fifth result in my list was a question tagged with the "excluded" tag ;-)
    – Jesse
    Aug 28, 2018 at 14:52

2 Answers 2

6

You can perform the search query you want if you group the tags together like this:

( [datatable] or [r] or [rstudio]) -[ggplot2] -[shiny] is:q

Mind the space after the opening bracket and the is:q at the end


It appears the query groups the - operator with the tag before it, e.g. it groups per or.

If you take a look at the query:

[datatable] or [r] or [rstudio] -[random]

the first result is a question tagged :

enter image description here

However, if you switch the tags around, and group [r] -[random] in one or:

[datatable] or [rstudio] or [r] -[random]

you get the following:

enter image description here

So my guess is that this query is split into the following:

([datatable]) or ([r]) or ([rstudio] -[random])

Which means it looks for:

1
  • 1
    Looks like grouping does the trick. Like this: ( [datatable] or [r] or [rstudio]) -[random] is:q Aug 28, 2018 at 8:12
4

Some stats to help with debugging:

270,396 results are given with the query:

[datatable] or [r] or [rstudio] or [ggplot2] or [shiny]

Assuming that query is working all right, there's a total 270,396 with any of the 5 tags.

Some other queries and their results:

[ggplot2] or [shiny] | 35,886 results
[ggplot2] | 23,959 results
[shiny] | 13,798 results
[datatable] or [r] or [rstudio] -[ggplot2] | 269,306 results
[datatable] or [r] or [rstudio] -[shiny] | 269,242 results
[datatable] or [r] or [rstudio] -[ggplot2] -[shiny] | 269,239 results
[datatable] or [r] or [rstudio] or [ggplot2] or [shiny] is:question | 270,372 results
[ggplot2] or [shiny] is:question | 35,724 results
[datatable] or [r] or [rstudio] -[ggplot2] -[shiny] is:question | 234,648 results

What we're looking at is that the not operator isn't working, even when we only do one at a time. In fact, the very first question when sorting by newest of [datatable] or [r] or [rstudio] -[shiny] includes , so it's not working even on one tag.

Shiny!

Oddly enough, the numbers do seem to be right when we add the is:question filter. And from the first few pages, I don't see any or questions using that search. So that can be a work around until this bug gets addressed.

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