Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQL actual "contains"

Tags:

contains

jira

jql

I want to perform a simple search on a text field with part of its content but I don't know the beginning. I basically want what someone would expect of a "contains search". If I search issue for 345, I would want this result:

123456
234567
345678
...

Which, in JQL, would be the result of the query issue ~ "*345*", but the * is not allowed as first character in wildcard query. Is there an easy way to get this result, preferably with a JQL query?

like image 261
Puck Avatar asked Oct 18 '22 12:10

Puck


2 Answers

Right now it's impossible to search JIRA for contains operation. As described in Search syntax for text fields, JIRA support Word stemming:

Since JIRA cannot search for issues containing parts of words, word 'stemming' allows you to retrieve issues from a search based on the 'root' (or 'stem') forms of words instead of requiring an exact match with specific forms of these words. The number of issues retrieved from a search based on a stemmed word is typically larger, since any other issues containing words that are stemmed back to the same root will also be retrieved in the search results.

That means, that you can search for common root of some word, but can't search for arbitrary part of it.

There is an issue in official JIRA bug tracker: Allow searching for part of a word (prefix / substring searches), which describes why this can't be implemented:

Lucene doesn't support prefix search.

As a workaround the suggestion is to use Script Runner plugin for JIRA:

issueFunction in issueFieldMatch("project = JRA", "description", "ABC\\d{4}")

See more on IssueFieldMatch here.

Another plugin, which can do regex jql is JQL Search Toolkit.

like image 198
grundic Avatar answered Oct 21 '22 05:10

grundic


Filter issues by "345" substring in the Summary field:

summary ~ "345"

Filter issues by "345" substring in the Description field:

description ~ "345"
like image 35
Petr Lazarev Avatar answered Oct 21 '22 04:10

Petr Lazarev