Search for an exact phrase with JQL

Advanced search lets you search for issues by building structured queries using the Jira Query Language (JQL). It's being updated to provide more accurate results when searching for an exact phrase.

For example, if you enter summary ~ "\"saturn summer sizzle\"" as a JQL query, the search results will only include issues where the summary contains the exact phrase "saturn summer sizzle".

exact phrase with focus.png

What's changed?

Searching for a phrase will only find issues with that exact phrase. This is an improvement on current behavior, where searches:

  • can include results with the words in a different order, with other words between them, or with variations of words
  • don’t include reserved words, like “a”, “an” or “the” (learn more about reserved words).

The feature will start rolling out in October.

This could affect your search results and automation rules

If you’re using saved filters or automation rules with exact search syntax, this may affect your rules and search results. There are a couple of different ways to approach this. You could:

  • leave your existing filters and rules as is, but expect different search results (especially if you’ve migrated from Jira Server or Data Center to Jira Cloud)
  • update the filters and rules to use (or not use) the new syntax, depending on your needs.

Want to learn more about advanced search?

Take a look at What is advanced searching in Jira Cloud?

30 comments

Andrey Kiyanovsky
Contributor
September 27, 2022

Not a good idea to have no option! Instead, you could leave ~ for stemmed search and introduce = for exact search. That would not break existing filters and let users have an option!

Like # people like this
Boris Berenberg - Modus Create
Contributor
September 27, 2022

Are there any docs that explain the change in detail?

Like # people like this
Michael Flores
Contributor
September 28, 2022

Does this mean that "string" will use fuzzy matching logic and "\"string\"" will be exact so that we can choose when to use each?

Like # people like this
Hugh Gibson
Contributor
September 28, 2022

This has been requested for many years, on the ticket https://jira.atlassian.com/browse/JRACLOUD-21372. It's clear from there that the syntax is to enclose the text to search for within quotation marks. That's why there are escaped quote marks in summary ~ "\"saturn summer sizzle\"" . You could mix an exact search with a normal search - for example text ~ "saturn \"summer sizzle\"" would find any ticket with the phrase "summer sizzle" as well as the word saturn in some other place.

Another issue raised in that ticket is that of sorting results by relevance. That's what Jira Server does, but Cloud sorts by Key descending. We've just migrated and I've compared results from both instances. Server gives much better result sets when you are trying to find a ticket using words which are very common. In the example search above, if those words were in a summary then that ticket would appear first, followed by tickets where they are just in comments. You wouldn't need to modify the JQL and just search in the summary.

It's great that exact searching is being done, but when you don't know the exact phrase but have a general idea, sort by relevance - which every other search does - is much better for finding results.

Like # people like this
Matthew McGarity
Contributor
September 28, 2022

This should be a helpful change in our org, where we often search by two-word phrases.  For example, we use the term "data store" a lot, and prior to this I would have to do something half-*ssed like:

 summary ~ data AND summary ~ store

...then still refine my search even further.  Being able to do this instead:

summary ~ "\"data store\""

...opens up a ton of possibilities for me — thanks!

Like # people like this
Harald Seyr
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 28, 2022

Hi,

thank you for this option to search for an exact match. This does help in most cases where I need exact match, however, it does still not solve the "search by numbers" issue:

Summary contains the string "AT-197681389", a search for

summary ~ "\"197681389\""

does not return it.

Thank you

Harald

Irene
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 28, 2022

@Boris Berenberg - Modus Create  - Thanks for checking. Docs is coming, I'll provide an update when it's available.

Like # people like this
Jacqui Shadforth
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 29, 2022

Hey @Andrey Kiyanovsky — stemmed searches will continue to work with the non-escaped quote syntax like summary ~ "hello world".

Exact search will use the escaped quote syntax summary ~ "\"hello world\"" which is also compatible with the existing behaviour on Jira Server/DC. I hope that clarifies.

Like # people like this
Yatish Madhav
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 31, 2022

Thank for this @Hannah McKenzie  and @Irene  - this will be great to use - I also ditto @Harald Seyr 's comment. Please advise?

Hannah McKenzie
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 31, 2022

@Harald Seyr @Yatish Madhav I believe it should work correctly if (using Harold's example above) you type the whole: 

summary ~ "\"AT-197681389\""

you should receive the correct result. Let me know if you still experience problems. 

Harald Seyr
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 16, 2022

@Hannah McKenzie : I am aware that searching for "text followed by number" does work. However, search for "just number" does not work. There was a user requesting support to search his Jira for a CVE number and this is not possible at the moment.

Hugh Gibson
Contributor
November 30, 2022

Earlier in these comments I mentioned sorting of search results by relevance which I think is more useful than exact matches. It's the default in Jira Server, but missing in Jira Cloud.

Atlassian has now raised a feature request. If you agree, please watch, vote for and comment to https://jira.atlassian.com/browse/JRACLOUD-80173

Eduard Diez
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 13, 2023

Hello in my case it does not work, I am looking for this:

summary ~ "\"[ICTO_\""

But JQL found some similar issues, but not exactly.

Like Alp Erguney likes this
Jacqui Shadforth
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 13, 2023

Hey @Eduard Diez

Unfortunately, special characters are not yet supported in text searches. If there are any special characters in your search, they will be ignored as they are not stored in the index. You can see the note in our documentation about it here.

We have a separate ticket for supporting special characters here: JRACLOUD-75866Please vote and comment so we can understand your use case. In this comment on JRACLOUD-21372 you'll also see @Will Darcy has also offered to set up time in Zoom if you'd like to chat more about your use case.

I hope it helps.

Like Dave Liao likes this
Slava Gefen
Contributor
July 4, 2023

Hey Community and @Hannah McKenzie !

We have got n-issues:
KEY-1 with Summary "Hello World".
KEY-2 with Summary "Hello World I'm here".
KEY-3 with Summary "Hello World I'm there".
...
KEY-n with Summary "Hello World I'm everywhere".

How to find only KEY-1 issue?

This search: Summary ~ "\"Hello World\"" gives all the results KEY-1 ... KEY-n.

Exact Summary.JPG

Thanks in advance!
With kind regards
Slava

Like # people like this
Hannah McKenzie
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 6, 2023

Hi @Slava Gefen, unfortunately it's not possible to exclude some words from an exact phrase search. So in your example above, you'll always see all results where the summary includes 'Hello World'.

Like Slava Gefen likes this
Jacqui Shadforth
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 12, 2023

Hey @Slava Gefen, just to add to @Hannah McKenzie's answer, perhaps you can look into the negation operators to achieve something you are after.

https://support.atlassian.com/jira-software-cloud/docs/search-for-issues-using-the-text-field

For example, if you want to exclude any issues with the word "I'm" then these should work:

summary ~ "\"Hello world\" -i'm"

or

summary ~ "\"Hello world\"" AND summary !~ "i'm"

Hope this helps.

Thanks

Like Hannah McKenzie likes this
Slava Gefen
Contributor
February 13, 2024

Hey @Jacqui Shadforth thanks for the suggestion!

summary ~ "\"Hello world\"" AND summary !~ "i'm"

In this case it'll work only for excluding issues with summary containing "I'm".

But there could be n-different examples besides that:

'Hello World he's there'
'Hello World they're nowhere'
'I wanted just to say Hello World'

Only something with using Regex might work, similar to this

summary ~ "\"Hello world\"" AND summary !~ "\"Hello world Regex(a..z,0..9,..)\"" AND summary !~ "\"Regex(a..z,1..0,..) Hello world\""

But I guess it's something unattainable)

Thanks in advance!
Slava

Like Andrea Monico likes this
KE
Contributor
February 14, 2024

How do I search for values within summary or description that has NC1234567 (7 numeric values right of NC are never the same)

How do I refine my advance search in JQL to pull the exact match of issues? 

Slava Gefen
Contributor
March 2, 2024

Hey @KE , you need just use the search criteria from the description of this article.

I've created these three issues

Capture1.PNG

And the exact search gives me only one issue:

Capture2.PNG

Thanks
With kind regards
Slava

Narsha Bachoo May 3, 2024

Hello,

How to search for issues where the summary starts with a specific prefix? Example SPCR is the text I want to query and this it the text which is found at the start of my issues.

Thanks.

Slava Gefen
Contributor
May 6, 2024

Hey @Narsha Bachoo

How to search for issues where the summary starts with a specific prefix? Example SPCR is the text I want to query and this it the text which is found at the start of my issues. 

Could you provide some examples (screenshots) to understand your need better? Is the prefix part of a word or an independent word?

Thanks in advance!
Slava

Narsha Bachoo May 6, 2024

Hello,

It is part of the summary, see below. This is the summary field and I need to extract all the issues where this prefix of 'SPCR-' is present.

 

 

Screenshot 2024-05-07 083442.png

 

Thanks,

Narsha

Slava Gefen
Contributor
May 7, 2024

Hey @Narsha Bachoo are you in Data Center OR Cloud Version?

Do you have also ScriptRunner installed?

Thanks in advance!
Slava

Narsha Bachoo May 7, 2024

I have cloud version and yes I do have scriptrunner installed.

 

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events