Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-85456

Using JQL / search CONTAINS ("~") for a word that starts or includes a hyphen ("-") or underscore ("_") returns incorrect results

XMLWordPrintable

      Issue Summary

      Using JQL / search CONTAINS ("~") for a word that starts with a hyphen ("-") or underscore ("_") results incorrect results

      Steps to Reproduce

      1. Run a JQL search for a specific project and see how many issues are returned.
      2. Add:
        summary ~ "-something" 

        or

        summary ~ "_something" 

      Expected Results

      Only issues with "-something" are returned, or alternatively, if using hyphen at the start of the string is not supported, an error message is displayed.

      Actual Results

      All issues in the project are returned.

      Notes:

      • Using "-x" or any other letter combinations instead of "-something" gives the same result:
      • Using numbers instead of letters does seem to give different( although still incorrect) results:
      • Using just a hyphen as the only search term does give an error stating "Unable to parse the text '-' for field 'summary'."

      Workaround

      • Avoiding hyphens at the start of a "CONTAINS" search, although the risk of this behavior is that it gives incorrect results without any indication, and it can easily mislead users with the results.
      • Using Exact phrase search seems to a void this behavior, as it ignores hyphens, for example this would return no issues (unless there is a specific issue with the word "something" on its own:
        project = SCRUM01 and summary ~ "\"-something\""

        1. 245 -5.png
          245 -5.png
          325 kB
        2. 254 -something.png
          254 -something.png
          229 kB
        3. 254 -x.png
          254 -x.png
          228 kB
        4. Unable to parse.png
          Unable to parse.png
          42 kB

              Unassigned Unassigned
              rchiquete Rene C. [Atlassian Support] (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: