Text search exact phrase with reserved keywords

Hajder Rabiee September 1, 2013
I wonder about text search capabilities in JIRA. I have read the
documentation regarding this, I know that there are some reserved keywords like
'and', 'not', 'will' etc.
Also, it should be possible to query for an exact phrase by enclosing
the phrase in double quotes and the reserved keywords in single/double quotes.
E.g "Terms 'and' conditions" should return issues with the exact phrase Terms and conditions,
but it results in an error. "Terms and conditions" will remove 'and' from the search
and return issues containing both words.
Do you have any ideas about this? Thank you.

2 answers

1 accepted

1 vote
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.
September 1, 2013

if you want to search for "Terms and Condition" use

~"\"Terms and Condition\""

Hajder Rabiee September 1, 2013

That will remove the keyword 'and' actually and return > 1 issues. The result I expect is either

exactly == 1 issue, or zero if the issue with that exact summary doesn't exist.

Hajder Rabiee September 1, 2013

Funny, I was 100% I tried that (that's why I linked to the documentation).

Sometimes it takes a second person to clear things up :).

Edit: Ok now I realised, the search yields different results if Conditions has a trailing s or not. I'm starting to think about stemming here.

~"\"Terms and conditions\"" will return > 1 issues. Each one having the phrase in it. E.g

xxxx terms and conditions

terms and conditions xxxx

xxxx terms and conditions xxx

How can I limit to only the exact phrase without surrounding words?

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.
September 1, 2013

The CONTAINS operator (~) does what it should: it shows issues that contains a certain phrase. So no solution out of the box.

Not sure if it works with script runner plugin there is a JQL function issueFieldExactMatch which could fit your needs. But I haven't tried this function yet.

Hajder Rabiee September 2, 2013

Using the REST API when the key is unknown, this method will yield unexpected results unfortunately. But I understand, if ithat's how the CONTAINS work, there's not much to do.

Is the only option to narrow down the results to use more fields?

0 votes
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.
September 1, 2013

summary ~"\"Terms and conditions\"" and summary!~"\" Terms and conditions \""

note the leading and trailing blanks in the second phrase

Suggest an answer

Log in or Sign up to answer