Search in comments using wildcard?

Sandra Meessen July 12, 2018

Hello, I want to search in comments in 1 specific project and expect to use wildcards, but "?" and "*" don't do the tric for me. Please help? The string I want to search on is "v2017_50_2_BO_UG". Values I expect are e.g. "v2017_50_2_BO_UG_1" or "v2017_50_2_BO_UG_1test1" or "v2017_50_2_BO_UG_3test2". Thanks!

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 13, 2018

Hi Sandra,

Jira has a limitation in regards to what it can search.  In this case, it is known as whole word searches.   However in your case, I think that you can use the fuzzy searches referenced in that document in order to find these issues.

If you're using Jira's basic search try to just enter a search of

v2017_50_2_BO_UG~

If you're using the advanced mode for searching, try the JQL search of:

comment ~ "v2017_50_2_BO_UG~"

 These search methods should be able to help you find this information in Jira.  Please let me know if this helps.

Andy

Sandra Meessen July 16, 2018

Hello Andrew, thank you for your hints. Unfortunately the fuzzy searchs gives way more results than wanted, because it does not only search for everyting starting with "v2017_50_2_BO_UG", but also gives everything looking like that, e.g. "v2017_50_2......"

 

e.g. I have 2 strings which can appear in comments "v2017_50_2_BO_UG_7" (9 appearances) and "v2017_50_2_BO_UG_7test1" (12 appearances). 

  1. When I advance search with "comment ~ "v2017_50_2_BO_UG_7" the results are the 9 appearances, without the 12 appearances 7test1.
  2. When I advance search with "comment ~ "v2017_50_2_BO_UG_7?" the result is a message saying "No issues were fount to match your search"
  3. When I advance search with "comment ~ "v2017_50_2_BO_UG_7*" the result is a message saying "No issues were fount to match your search"
  4. When I advance search with "comment ~ "v2017_50_2_BO_UG_7~" the results are 569 appearances of everyting looking like  "v2017_50_2_BO_UG_7", variying from "v2017_50......." to "v207_50_2_BO_UG_7".

So none of these give me the answer I am looking for (12 + 9 = 21 appearances starting with "v2017_50_2_BO_UG_7").

 

Thanks for the help.

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 16, 2018

If you specifically have only two different strings you want to see in the same search results, perhaps try this instead,

(comment ~ "v2017_50_2_BO_UG_7" OR comment ~ "v2017_50_2_BO_UG_7test1")

I would expect this to return the 21 expected.  I understand if this search is not desirable if you have multiple similar terms to search, however I believe that what you have seen here so far is a limitation of Jira's whole word searches I mentioned previously.

If you are looking to use a different solution here, you might examine Adaptavist's Scriptrunner.  This plugin to Jira provides some extended JQL functions, including the ability to use regular expressions as a means to search issues in Jira.

Sandra Meessen July 16, 2018

Hello Andrew, I don't have these 2 strings expected, actually there are (at the moment) about 25, al startin with "v2017_50_2_BO_UG" followed by other characters. At the moment my search query looks like you suggest "comment ~ "v2017_50_2_BO_UG_7" OR comment ~ "v2017_50_2_BO_UG_7test1 OR ..... OR... OR..... (25 times)". So this search query does not look efficient and not very readable. Therefore I'm looking for alternative.

When I try the Scriptrunner option "issueFunction in issueFieldMatch("project = QSD", "comment", "v2017_50_2_BO_UG_\\d{1}")" I get an errormessage "Error occurred communicating with the server. Please reload the page and try again.".Errormessage on scriptrunner search options.JPG 

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 18, 2018

Hi Sandra,

Sorry about that.  I believe I made a mistake here in recommending scriptrunner for your specific user case. It looks like that specific function is intended to look at issue fields in Jira, however the comments on issues are not technically issue fields, hence I don't think that is going to help us here find what you are looking for.

I tried to go back and play with this some more.  At the moment I am curious to see if this JQL query might help:

comment ~ 'v2017_50_2_BO*' AND comment ~ 'UG*'

I'd like to know if this is returning all the issues you are looking for or not.  If this is returning more issues than you want, could you let me know a few more examples of the ones you would expect to be excluded by your query, and then perhaps I can continue to work out how we can refine this query to find what you want here.

Sandra Meessen July 25, 2018

Hello Andrew, my original search query looks like "project = QSD AND
(
comment ~ 'v2017_50_2_BO_UG_1' OR
comment ~ 'v2017_50_2_BO_UG_1test1' OR
comment ~ 'v2017_50_2_BO_UG_1test2' OR
comment ~ 'v2017_50_2_BO_UG_1test3' OR
comment ~ 'v2017_50_2_BO_UG_1test4' OR
comment ~ 'v2017_50_2_BO_UG_1test5' OR
comment ~ 'v2017_50_2_BO_UG_1test6' OR
comment ~ 'v2017_50_2_BO_UG_2' OR
comment ~ 'v2017_50_2_BO_UG_2test1' OR
comment ~ 'v2017_50_2_BO_UG_2test2' OR
comment ~ 'v2017_50_2_BO_UG_3' OR
comment ~ 'v2017_50_2_BO_UG_3test1' OR
comment ~ 'v2017_50_2_BO_UG_3test2' OR
comment ~ 'v2017_50_2_BO_UG_3test3' OR
comment ~ 'v2017_50_2_BO_UG_4' OR
comment ~ 'v2017_50_2_BO_UG_4test1' OR
comment ~ 'v2017_50_2_BO_UG_5' OR
comment ~ 'v2017_50_2_BO_UG_5test1' OR
comment ~ 'v2017_50_2_BO_UG_5test2' OR
comment ~ 'v2017_50_2_BO_UG_5test3' OR
comment ~ 'v2017_50_2_BO_UG_6' OR
comment ~ 'v2017_50_2_BO_UG_6test1' OR
comment ~ 'v2017_50_2_BO_UG_7' OR
comment ~ 'v2017_50_2_BO_UG_7test1'
)

and gives me 221 issues. If I use your suggestion I get 289 issues. I checked the differences and most of them give also issues with "v2017_50_2" as result back, so without "_BO" and "UG". 

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 25, 2018

Hi Sandra,

Sorry that this doesn't seem to have a clear way to do what you want here.  Jira does have a limitation in regards to full word searches, and since these strings are not exactly words I think this is the major hurdle we have to overcome in this use case.   If these were issue fields, I think we would have had a better solution by now between Jira and scriptrunner and its own JQL functions.  However since these are comments, we can't really use these other alternatives.

Could you tell me more about what this data is used for?  If you need to see a list of issue keys, this might be something we can generate via a SQL query.  However if you were wanting to build a dashboard gadget for these issues, the this might not help since it isn't something that would be returned via JQL, and in turn you would not have a JQL filter to use.

But if you just want the issue keys in Jira that have these specific comments, you might be able to do a query like this:

SELECT ja.id, ja.issueid, ja.author, ja.actiontype, ja.actionbody, ja.updated, P.PKey || '-' || ji.IssueNum as IssueKey
FROM jiraaction ja
join jiraissue ji on ji.id = ja.issueid
join Project P on ji.Project = P.Id
where actionbody like '%v2017_50_2_BO_UG_%' and p.pkey='QSD';

This syntax works for postgresql, but it might be slightly different for other sql types.   By using the like operator in SQL, I was able to find all the comments/issues that have the specific string of 'v2017_50_2_BO_UG_' as a comment on that issue.

Suggest an answer

Log in or Sign up to answer