How to search in JQL CF with free or exact text

Issue #7 resolved
Adolfo Casari created an issue

I have customfield that contain values with a minus sign. I can't find a way to search in JQL for issues that do not contain a minus value in this CF. I have tried both free and exact text, ut I can't get to the right JQL syntax.

Note: customfield is of type scripted field (from script runner plugin). This return strings that represents integers (positive and negative).

Thanks in advance,

Comments (11)

  1. &(*&)#)_*#@@(*)(@*)(*@ repo owner

    here is how to "Performing Text Searches"

    While it is ok to store numerical value, you should not use text custom field for searching numerical value. Here are the reason :

    • '*' is not allowed as first character in wildcard query
    • jira indexing is tailored in a way that '-' is steamed out when it is the first char

    Searching for issue begining with "-" will show no result : 0.png

    But , searching for issue beginning with "1" whill show issue with "-1" and "1" 1.png

    Searching for "-" within the content is ok : 11.png but you must not put a wildcard in first position : 111.png

    it also appears that the text custom field will not allow certain value; ie : "-1" (if the string is less than 3 char and begins with a wildcard , sounds like a jira bug.. but you should not use a text field for a numeric value).

    Solution

    Use a Numeric Custom field 21.png 2.png

    You can the use a simple jql query for searching positive or negative value 3.png

  2. Adolfo Casari reporter

    Thanks for your complete description. Unfortunately, scriptrunner scripted fields seems not to support Numeric(stats), since when I create the CF only the text(stat) searchers are available. Numeric is available, but only the one from Jira, not the plugin.

  3. &(*&)#)_*#@@(*)(@*)(*@ repo owner

    ok, I will publish a new version that will allow statistic (ie : stattable searcher) for scripted date field and scripted number.

  4. Adolfo Casari reporter

    Thanks a lot for your help!

    (I only wonder why the 2 dimensional gadget shows integer values with a decimal point and 0. On Issue screens and Navigator shown as pure integers).

  5. mehran bhutto

    To search in JQL (Jira Query Language) using a custom field (CF) for free or exact text, you can use the "~" and "=" operators respectively. Here's how you can do it:

    1. For free text search:

      • To search for issues where the custom field contains a specific word or phrase, you can use the "~" operator along with the CF name and the text you want to search for. For example: cfName ~ "text"
      • This will retrieve issues where the custom field (cfName) contains the specified text (text), regardless of the case or word boundaries.
    2. For exact text search:

      • To search for issues where the custom field has an exact match for a specific word or phrase, you can use the "=" operator along with the CF name and the text you want to search for. For example: cfName = "text"
      • This will retrieve issues where the custom field (cfName) has an exact match for the specified text (text), considering the case and word boundaries.

    Remember to replace "cfName" with the actual name of your custom field in Jira. Also, note that the search syntax and available operators may depend on the version of Jira you are using.

    If you have multiple custom fields or want to combine multiple conditions in your JQL query, you can use logical operators such as "AND" and "OR". Here's an example of a JQL query combining multiple conditions:

    javaCopy codecfName1 ~ "text1" AND cfName2 = "text2"
    

    This query will search for issues where cfName1 contains "text1" and cfName2 has an exact match for "text2".

    I hope this helps! Check my latest chat gpt detector tool.

  6. Log in to comment