10

I am trying to create a new custom question filter in the new-nav tabs that shows all questions that have at least one of multiple tags, yet do not contain any of certain tags.

An example of what I am currently able to do:

or not not

The problem is that or is executed after not, so the exclusion is only applied to the second tag. How can I indicate the order of operation for this search query?

Idea 1:

What I basically would like to enter into the question search bar is:

( or ) not ( or )

Or in the top search bar format:

([java] or [c#]) -([generics] or [array])
([java] or [c#]) -[generics] -[array]

Parentheses, however, are not supported.

Idea 2:

Another way to fix this problem would be to repeat the "not" clauses after each desired tag:

not not or not not

This won't work though since every tag is only allowed to be used once in the search bar. This way is also just plain messy.

9
  • Assuming you mean a new-nav tab by "custom question filter tab", I found a sort of hacky way to do something like this. It doesn't persist correctly with the new-nav tabs I'm finding. Search [tag1] or [tag2] -[tag3] -[tag4] in the top bar and it does indeed work correctly. However, saving the new-nav tab and refreshing/switching from and to it does not persist the correct search. The hack... Is bookmarking the link the search produces. I've tested it, and this does seem to work. That the correct behavior does not persist after saving feels like a bug to me.
    – Kendra
    Nov 10, 2016 at 19:44
  • Proof of my test, here on MSO: [bug] or [support] -[discussion] -[tags] (That's a link, though it may not look like it.)
    – Kendra
    Nov 10, 2016 at 19:45
  • 2
    @Kendra That doesn't seem to work on the main site. I tried [java] or [c#] -[android] and I still see android questions.
    – Tot Zam
    Nov 10, 2016 at 19:49
  • @Kendra Modified the question to make it clear that I am talking about the new-nav tabs.
    – Tot Zam
    Nov 10, 2016 at 19:52
  • Hmm... Removing -[android] it does appear it's filtering some of the questions... But not all of them. Adding an asterisk proves that it's definitely not working... Very odd.
    – Kendra
    Nov 10, 2016 at 19:54
  • 1
    After a little more playing around, this really looks like a bug to me. It's inconsistent between Meta and Main, and if you save the search as a tab on Meta, the correct filtering does not persist.
    – Kendra
    Nov 10, 2016 at 19:57
  • @Edward Your proposed title is not what I'm asking for. I don't want "always a third tag". I want a way to exclude a list of tags from all included tags.
    – Tot Zam
    Nov 28, 2017 at 16:51
  • Okay. The reason I wrote "and always a third tag" was because the excluded tags following don't need to be inside brackets, making them a less important part of this search feature. So my improved question title is "Find questions with one of multiple tags and exclude some tags"
    – Edward
    Nov 28, 2017 at 20:33
  • @TotZam I now understand why my title idea doesn't work. I was describing the use of brackets. I've created a better question title, also see my previous comment and the answer I've written below.
    – Edward
    Nov 28, 2017 at 22:22

2 Answers 2

3

Maybe this is a bit late, but will definitely help future readers.

Parentheses are supported in the search.

But only for the tags which should be included (not neglected), and you must leave a space after and before the parentheses.

Example:

( [java] or [c#] ) -[generics] -[array]
2

This new feature for more advanced question searches/filters on the site navigation page
or search bar can be described as "using brackets to separate a Boolean logic/algebra
operator from other tags
" or more simply, for what the question asker would like:
Find questions with one of multiple tags and exclude some tags.

It would be used in a similar way to regular expressions, for finding questions that have
one of multiple tags and/or don't have any tags from another group. However, the main
difference is that brackets inside brackets would probably not be allowed because it
needs more text processing and not many people would use it.

Here's a simple example (similar to the original idea above):

[css] ([html] or [javascript]) -[node.js] -[jquery]

The parentheses/brackets make sure that the or operator only includes the two tags
around it, not other search query text - so that questions found have the CSS tag and
are about HTML or JavaScript but don't include Node.JS or jQuery code.

Update: a year after this question was posted, the feature can be found on Stack
Overflow Jobs (see the advanced search query parameters help page) but it hasn't
been added to the main site - the main advanced search options there for metadata
are: score/answer/views range, creation/last active dates, users/owner details, Boolean status info, tags, or/not/wildcard logic operators and content search (title/body).

You must log in to answer this question.

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