CONTAINS (~) does not seem to work when searching description?

Dan Temple June 8, 2016

I'm trying to use the ~ operator as per https://confluence.atlassian.com/jira/performing-text-searches-185729616.html

The description in my test issue is one line like this:

     It contains ABC=someWord_and_these_TOKENS and other text too.

 Now if I search with:

  project = "GMX" AND Description ~ "ABC=someWord_and_these_TOKEN"

it finds my test issue. On the other hand, these do not work:

  project = "GMX" AND Description ~ "ABC=someWord_and_these_TOKE"
  project = "GMX" AND Description ~ "ABC=someWord_and_these_TOKE?" 
  project = "GMX" AND Description ~ "ABC=someWord_and_these_TOKE*"
  project = "GMX" AND Description ~ "ABC=someWord_and_t?ese_TOKENS"

 This seems baffling - these are pretty close to the examples in the documentation.

Version: Atlassian JIRA Project Management Software (v7.1.2#71006-sha1:8e7e309)

7 answers

1 accepted

3 votes
Answer accepted
Boris Georgiev _Appfire_
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.
June 9, 2016

Hi Dan,

JIRA search will remove the underscore (_) character and will treat it as a whitespace https://jira.atlassian.com/browse/JRA-32441 https://jira.atlassian.com/browse/JRA-5567 so when you're searching for

"ABC=someWord_and_these_TOKE" for example it will try to find an issue that contains all the words - ABC=someWord, and, these, TOKE and will probably actually ignore and  word https://confluence.atlassian.com/jira/performing-text-searches-185729616.html#PerformingTextSearches-Reservedwords 

You can search for an exact phrase you need to quote the phrase like that "\"ABC=someWord_and_these_TOKENS\""

Also in some cases and might be considered as a boolean operator https://confluence.atlassian.com/jira/performing-text-searches-185729616.html#PerformingTextSearches-Booleanoperators

So it's a bit complicated as the text you're searching is actually split into phrases and a lot of rules apply. 

Would you tell us what's the exact use case i.e. when having this phrase or similar "ABC=someWord_and_these_TOKENS and other text too" - what do you want to search for , so we can figure out the correct way to do that via JQL?

Boris Georgiev _Appfire_
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.
June 9, 2016

As a workaround you may consider using the Script Runner JQL function issuefieldmatch  which allows you to match field value using regular expression and I think this will be much more reliable than the JIRA fuzzy search in this case where you've got special character to match.

https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_issuefieldmatch

Dan Temple June 9, 2016

Thanks for an excellent explanation - looks like the underscores are to blame. My use case is in fact that I have to match the exact word (with underscores) - it is the formal name of a test - so the exact phrase matching looks like a solution even if the syntax is a bit clunky.

I'll take a look at issuefieldmatch too.

Dan Temple June 9, 2016

Hmm. I removed the and part of the token, to avoid confusion (and my use case will not have any ands in it). Also reduced to searching for the part after the =. However, the problem persists even if I quote the phrase, i.e.:

"\"someWord_these_TOKENS\""

 ..matches, whereas any partial or wild-carded version does not match. So I think the fuzzy search is just not going to work.

1 vote
Sergio Bobillier November 15, 2019

Having exactly the same issue with the same use case, I'm searching for a Test Case name which contains underscores in the contents of a text field.

I still don't understand how can JIRA have such a poor search engine. I mean, JIRA is normally used by developing teams, searching for words with underscores is just a part of every developer's daily life.

Sven Rollinger January 23, 2020

Yes, I think the same!!

0 votes
Daniel Tinarwo May 28, 2021

Hey,

I also ran into the same issue, but it's saying that the operator isn't supposed by the field.

2021-05-28 14_39_01-Licensing - Reports - Service project - Jira Service Management — Mozilla Firefo.png

0 votes
Christopher_Siege March 18, 2018

Also having a lot of frustrations with searching issues that have underscores in issue description. 

0 votes
robert.stenitzer@logicx.at January 25, 2018

Hi!
I did ran in the same topic with the requirement to search for an text containing several underscores.

I also tried the descripted escaping "\"someWord_these_TOKENS\"" with no result.

Are there any updates, additional infos available how to overcome this problem?

any help is appreciated

0 votes
Dan Temple June 9, 2016

Anything particular in them? They look like the standard information about searches, can't find anything that indicates that there should be something non-standard about my syntax?

0 votes
Meck
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.
June 9, 2016

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events