JQL for labels does not return correct results

Nari Man
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013

I have a query that returns 25 issues. Out of these 25 issues, 2 have label xxx.

I add to my JQL, AND Labels not in ("xxx") and I get 10 issues. I replace it with AND Labels in ("xxx") and I get 2 issues. Something here is wrong. Any ideas?

thanks

10 answers

1 accepted

6 votes
Answer accepted
Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013

I guess out of the 25 issues 13 have no labels at all. That would explain the two other result sets (2 and 10).

Note: label not in (xxx) will display all issues where the label is different from xxx and not empty

Nari Man
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013

Any way I can capture the 23 tickets that I am looking for?

Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013

yes, use

AND (Labels not in ("xxx") or labels is EMPTY)

edit: sorry, this is how it should work

Ashish Kumar October 5, 2014

So, your query basically excludes the items which does not contain any label.

 

You can try this instead: 

(labels != "LBL1" OR labels = null)
Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2014

labels =null will not work, you need to use labels is empty to capture those issues with no label

0 votes
Keith Robertson August 28, 2023

Instead of

labels != xxx

labels not in (xxx, abc)

use

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

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

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

These avoid having to check whether labels IS EMPTY.

0 votes
Ashish Kumar October 6, 2014

As per my understanding *[labels = null]* and [labels is EMPTY] doesn't makes any difference in results. I have tested with both the options and got the same result.

Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2014

true, unless someone adds a label named "null"

0 votes
Sumit Kumar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013

if not he can do indexing through the groovy code for issues in the filter(25 issues) that he has mentioned.

it wont take much time I guess.

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.
November 10, 2013

You don't know that indexing is the problem yet. It could be the structure of the query.

Nari Man
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013

the JQL is : project = projectname AND resolution = Unresolved AND fixVersion = EMPTY AND labels in ("labelname")

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.
November 10, 2013

Ah, good. Sort of. That query is not structured in a way that might be causing a problem. Straight clauses joined by "and"s are almost always straightforward.

So, now we need to ask you to test the effects of re-indexing

0 votes
Sumit Kumar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013

Please Re-index.

0 votes
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.
November 10, 2013

Sorry, obviously not enough coffee this morning.

0 votes
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.
November 10, 2013

I suspect we might want to see the definitions of both queries in full. It can be important where and how a clause is added to a query. (If not, then re-indexing is the next step)

0 votes
Theinvisibleman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 10, 2013
Hey there, have you tried re-indexing? Quite a lot of search-related issues could be caused by the index. Please try to perform a complete re-index, and see if the problem persists
0 votes
Nari Man
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2013
One is with "NOT".
0 votes
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.
November 10, 2013

I can't see the difference between your queries or how you are entering them, it just says "and labels in xxx" twice.

Suggest an answer

Log in or Sign up to answer