JQL Exclude Text Search

Stephen Gurnick
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.
February 26, 2015

I am attempting to perform the following JQL search in JIRA:

project = PROJECTNAME AND status = Open AND assignee in (username) AND comment !~ "generic"

My understanding of what this should return is: All open issues in project PROJECTNAME that are assigned to username that do NOT contain "generic" in the comments.

What I end up getting in the results are issues that both do and do not contain the text "generic". The results do correctly match the other criteria in the JQL statement.

I found another Answers post regarding similar behavior. However the result there was to save two separate filters and then join them together in third filter. While this is indeed a workaround, is this the expected functionality?

Based on the JQL documentation, my understanding of the !~ operator in text searches is it performs a DOES NOT CONTAIN fuzzy search.

Is my logic incorrect here? I am missing something else?

Appreciate any help you can provide.

4 answers

1 vote
Chris Purser December 23, 2016

Yeah I'm having the same issues - not a single effort to reveal a result excluding a word has worked for me.

Examples that all fail:

project = HLP AND text ~ "create" -build

project = HLP AND text ~ -build

project = HLP AND text ~ "create" NOT "build"

project = HLP AND NOT text ~ "build"

and several others that should seem to work but don't according to the instructions here

https://confluence.atlassian.com/jirasoftwarecloud/search-syntax-for-text-fields-764478343.html

Aditya Khandelwal March 6, 2019

Instead of 'text', I could split it into 'summary', 'description', etc and then I was able to use it like:

summary~"blah" AND summary !~"blah1"

or description !~"blah2"

0 votes
Amir Katz (Outseer)
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.
August 26, 2019
0 votes
Maximus Tremor October 10, 2016

Actually that should work:

project = PROJECTNAME AND status = Open AND assignee in (username) AND comment ~-"generic" (please pay attention to 'minus' sign befor 'generic' copy).

For details please check out https://confluence.atlassian.com/jirasoftwarecloud/search-syntax-for-text-fields-764478343.html ("Excluded term: -" section).

Peter Flynn January 4, 2018

For me that gives an error "Expecting either 'OR' or 'AND' but got 'generic'" (in JIRA 7.2)

Daniel Johnson March 8, 2019

I tried it with the - inside the quotation and it displays results, but it's no different than if I were filtering for that specific text, so it didn't work for me.

Kirk Nedreberg May 9, 2019

I got an example to work for me with the - and NO quotation marks.

[Correction] It filtered out most of the results, but still had some with the text I wanted excluded.

0 votes
philleicht
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.
February 26, 2015

Hey Stephen, 

I tend to use NOT instead of the symbolic operator for negation, however I don't know if that would work in your case. 

Maybe you could try AND NOT comment ~ "generic". 

 

I hope it helps. 

Regards, 

Philipp

Stephen Gurnick
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.
February 27, 2015

Hi Philipp, I did try this method as well, but unfortunately got the same results as using the !~​ operator. Thank you for the suggestion though. -- Stephen

Like Carla Walker likes this
Peter Flynn March 16, 2020

If I do AND NOT text ~ "anything" then the search always returns zero results. Boggles the mind how such basic things never seem to work as expected in JIRA.

Suggest an answer

Log in or Sign up to answer