Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

JQL filter: "get stuff" and labels not in (XXX) also filters "EMPTY"

Edited

I have a query that is something like this:

project in (X, Y) AND component in (A,B,C,...) AND labels not in ("stuff")

This filter returns less than expected.  It filters the things with label "stuff", but also filters things with label = "EMPTY"

We fixed by changing the label stuff to: (labels != "stuff" OR labels is EMPTY)

However, it doesn't make sense to me that things without a label need to be specifically selected since "EMPTY" should not equate to "not stuff".  

Am I missing something or is this a bug (or a feature)? 

2 answers

1 accepted

3 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 03, 2023 • edited Feb 07, 2023

This is expected behavior. When you are searching on label != X it will only search on issues that have the labels set to something, and that is why you have to include labels is EMPTY as well. Same thing if you would have a search that excludes a component, you would then have to include the empty ones as well.

OK, expected maybe, but weird IMHO. Thanks!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 04, 2023

It's not weird, it's logical.  Computers are logical engines, you have to be precise with them.  Humans are not, we can make assumptions!

Like Mikael Sandberg likes this

We agree on the end of your statement, but not the beginning. Computers are not so much logical as logic engines that have actions programmed by humans based on requirements.  In this case, it's a database engine with a rudimentary programming language, JQL.

To illustrate my expectations, here's how I think of the problem: If I have a set of 10 marbles, some are swirled with the color blue, some red, and some just clear.  If I ask you to "please give me all the marbles that are not blue", I'd expect you to give me the clear and red marbles, not just the red marbles.  

However, I can also see how the programmer might have thought differently.  Perhaps their design grabs all the things with labels and then returns the ones without the label I don't want.  That might have been the requirement they worked to or it's a bug (I favor the latter).

Anyway, if I assume the former requirement, then it explains the results.   

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 04, 2023

So how do you answer the question "please give me all the marbles that are not blue" when you have some marbles where you don't know what colour they might be?

Logically, you can not.  Humans assume, computers need clear rules.

There is no assumption being made.  The request is made on the database which has numerous, known records. The URL I'm using to access our Jira database provides the context of what records to query.

 If I make a simple JQL query such as: "labels in (BLUE, RED)", it selects all records in the database that match that have those labels.  It's only problematic when I ask "labels != BLUE" 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 04, 2023

But how can you tell that a marble that you can not see is of a certain colour?

Simple answer, you can not.

Instead of

labels != stuff

labels not in (stuff, the_void)

use

# Select ticket if missing the named label.
NOT (labels = stuff)

# Select ticket if missing ANY of the named labels.
NOT (labels = stuff AND labels = the_void)

# Select ticket only if missing ALL of the named labels.
NOT (labels in (stuff, the_void))

These avoid having to check whether labels IS EMPTY.

Note: labels != stuff excludes when labels IS EMPTY, but NOT (labels = stuff) includes it!

Suggest an answer

Log in or Sign up to answer