Hello All,
I want to search issues whose summary EXACTLY match with given string but it should be case-insensitive. I used below jql
issueFunction in issueFieldExactMatch("project = ABC", "Summary", "(?i)Test")
I know there is an issue with summary "test", but the JQL does not return it as a result.
Script Runner version 5.5.9
Jira version: 7.13.5
Using JIRA through server
Could you please help
Thanks and Regards,
Swapnil Srivastav
I don't know why it doesn't work, but looking at documentation, you can apply the workaround and search like this:
issueFunction in issueFieldMatch("project = ABC", "Summary", "^(?i)Test$")
Hello @Ilya Turov ,
Thanks for your quick response.
It is working on JQL advance search tab but not when I am using the same in groovy script along with JQL Query Parser
Could you please help me with that.
Thanks and Regards,
Swapnil Srivastav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the thing is, I didn't even get it to work in advance search tab
can you show the code you are using? maybe, I'll be able to help then
also you can try same workaround in script, maybe the behaviour is different
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ilya Turov ,
Regret to inform, but the above JQL is not working for me as I need to perform EXACT search. I am using below query:
issueFunction in issueFieldExactMatch("project = ABC and issuetype=DE", "summary", "FGH")
and it is returning correctly the issues with summary "FGH", but I want to list issues with summary "fgh" also.
I cannot use issueFieldMatch() because that would give results with nearby values as well like "fghij" or "ABCFGH".
I need to perform exact search but it should be case-INsensitive.
Kindly help
Regards,
Swapnil Srivastav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
searching for '^test$' with regular fieldMatch will work same as searching for 'test' with exactFieldMatch since ^ and $ stand for beginning and end of the string, hence 'workaround'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ilya Turov ,
Yes, I know, it should as per documentation , but it is not. I have a summary as "Other" but on using,
issueFunction in issueFieldExactMatch("project= ABC and issuetype =DE", "Summary", "^Other$")
no issues are given as result. I think it is not accepting any sort of regular expression
Regards,
Swapnil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
because you are still trying to use issueFieldExactMatch, while I'm telling you to try issueFieldMatch
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ilya Turov ,
Sincere apologies.
I got confused between the two. Now, it works properly in JQL query but not when I use in groovy. As groovy treats ${} as interpolation and it is expecting a literal value after $ sign or an escape character but if put an escape character, compilation error is resolved but the JQL wont be correct then.
Below is the groovy, I am trying:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.searchSearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.Issue
def summaryObj = getFieldById(getFieldChanged())
def summary = summaryObj.getValue()
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def issue = underlyingIssue
if(issue == null)
{
return
}
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def query = jqlQueryParser.parseQuery("issueFunction in issueFieldMatch('project = Cluster and key!= "+issue.key+"', 'Summary', '^(?i)"+summary+"$')")
if(results.getTotal()>0)
{
summaryObj.setError("Issue Summary already exists.")
}
else
{
summaryObj.clearError()
}
Regards,
Swapnil Srivastav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
escape character is not going to mess with your query, because it's well, escape character. \$ is going to be evaluated as $ in your query
so using this:
"issueFunction in issueFieldMatch('project = Cluster and key!= ${issue.key}', 'Summary', '^(?i)${summary}\$')"
should perfectly work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ilya Turov ,
Thanks a lot for being continuous and replying with new solutions.
I tried the exact same line, but it is not working as expected. It does not give compilation error but allows duplicate summaries if the case of text is different.
Best Regards,
Swapnil Srivastav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ilya Turov ,
The solution you suggested works perfectly.
JQL:
issueFunction in issueFieldMatch("project = ABC and issuetype = "DE", "Summary", "^(?i)Test$")
and for groovy:
issueFunction in issueFieldMatch("project = ABC" and key != ${issue.key}", "Summary", "^(?i)${summary}\$")
Thanks a lot for the response and apologies for creating confusions.
Thanks and Regards,
Swapnil Srivastav.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
as long as you got it to work :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.