Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-23088

Issues search does not search for numbers in a text field

      I have some issues with a custom text field, containing string like "week-2010-11-15", "week-2010-11-22", etc.

      query ( weekField ~ "week" ) returns issues, while ( weekField ~ "2010" ) does not. Also, query ( weekField ~ "week-2010-11-15" ) returns all issues with "week" in this field, no matter what numbers are after.

      Seems like really strange behavior. How it is expected to search for numbers in a text field then?

            [JRASERVER-23088] Issues search does not search for numbers in a text field

            elonderin added a comment -

            there is a simliar issue with the german analyser: just searching for the number of an issue ID in a text field wont return the issue. u have to provide the full issue id. e.g.

            text ~ 4587 wont find an issue where "MYPROJ-4578" is contained in a text field but the search for text ~ MYPOROJ-4587 does.

            this is not very "google like" search and IMO should be fixed as the number part is clearly a separate token. it is just a matter on how to config the analyser chain.

            elonderin added a comment - there is a simliar issue with the german analyser: just searching for the number of an issue ID in a text field wont return the issue. u have to provide the full issue id. e.g. text ~ 4587 wont find an issue where "MYPROJ-4578" is contained in a text field but the search for text ~ MYPOROJ-4587 does. this is not very "google like" search and IMO should be fixed as the number part is clearly a separate token. it is just a matter on how to config the analyser chain.

            goran added a comment -

            Are you seriously saying that there is no way to have a text search with exact match? I find that hard to believe, so I hope I am mistaken. Please if you could clarify, thanks.

            goran added a comment - Are you seriously saying that there is no way to have a text search with exact match? I find that hard to believe, so I hope I am mistaken. Please if you could clarify, thanks.

            bain added a comment - - edited

            Hello,

            Using "Text" fields for exact matching in JIRA is a bad idea. JIRA processes all the text within a "text" fields that will generally make exact matching impossible. I guess you have two options:

            • Can you use the date picker custom field instead? In this field you can search for an "exact day".
            • You can set your indexing language to other and do a re-index. This will mean that searching through comments, summaries and other text fields will no longer be smart. This will make searching for issues via the summary or comment field much harder.

            Details

            "~" actually means do a full text search with Lucene. It basically means "try and find all issues whose weekField contains text relevant to 'week-2010-11-15'".

            How it does this is quite complicated and I am no expert on the topic. Basically, we first index the issue and all the text from the "text fields" (e.g comments, summary, description,...). The text is passed through a filter that removes common words and process the text in a way that makes it easy to do a full text search (e.g. it stems the text). It then stores the processed text in the index so that it can be searched later. In you case when using the Russian indexer it is actually only storing "week" in the index. The numbers at the end are dropped by the Russian indexer (not sure why).

            When you do a search weekField ~ 'week-2010-11-14' JIRA (aka Lucene) runs the 'week-2010-11-14' through the same processor that was used when the issue was indexed to get 'week' essentially giving the query weekField ~ 'week'. JIRA then searches though the index for issues whose weekField has 'week'. You will not be able to find '2010-11-14' because it is neither indexed or searched.

            This whole process will make searching through text fields more "Google" like, however, it makes searching for exact matches almost impossible in "text fields". Different indexing languages behave in different ways. Different versions of JIRA behave in different ways.

            Regards,
            Brenden.

            bain added a comment - - edited Hello, Using "Text" fields for exact matching in JIRA is a bad idea. JIRA processes all the text within a "text" fields that will generally make exact matching impossible. I guess you have two options: Can you use the date picker custom field instead? In this field you can search for an "exact day". You can set your indexing language to other and do a re-index. This will mean that searching through comments, summaries and other text fields will no longer be smart. This will make searching for issues via the summary or comment field much harder. Details "~" actually means do a full text search with Lucene . It basically means "try and find all issues whose weekField contains text relevant to 'week-2010-11-15'". How it does this is quite complicated and I am no expert on the topic. Basically, we first index the issue and all the text from the "text fields" (e.g comments, summary, description,...). The text is passed through a filter that removes common words and process the text in a way that makes it easy to do a full text search (e.g. it stems the text). It then stores the processed text in the index so that it can be searched later. In you case when using the Russian indexer it is actually only storing "week" in the index. The numbers at the end are dropped by the Russian indexer (not sure why). When you do a search weekField ~ 'week-2010-11-14' JIRA (aka Lucene) runs the 'week-2010-11-14' through the same processor that was used when the issue was indexed to get 'week' essentially giving the query weekField ~ 'week'. JIRA then searches though the index for issues whose weekField has 'week'. You will not be able to find '2010-11-14' because it is neither indexed or searched. This whole process will make searching through text fields more "Google" like, however, it makes searching for exact matches almost impossible in "text fields". Different indexing languages behave in different ways. Different versions of JIRA behave in different ways. Regards, Brenden.

            Andrew Chernyshov added a comment - - edited

            It's strange, why didn't you get any issues on "week" search?.. "~" means "contains", isn't it?

            Our indexing language is set to "russian", and i'm still gettng full of issues on "week", but this is not actually the point.

            The point is that i cannot get any result from text search on a number.

            Just have created an issue with summary "Test 22rr33".
            Search on "22rr33" returned this issue.
            I changed summary to "Test 223344".
            Search on "223344" returned no issues.

            Andrew Chernyshov added a comment - - edited It's strange, why didn't you get any issues on "week" search?.. "~" means "contains", isn't it? Our indexing language is set to "russian", and i'm still gettng full of issues on "week", but this is not actually the point. The point is that i cannot get any result from text search on a number. Just have created an issue with summary "Test 22rr33". Search on "22rr33" returned this issue. I changed summary to "Test 223344". Search on "223344" returned no issues.

            bain added a comment -

            Hello Andrew,

            I was unable to reproduce this problem. Here is what I did:

            1. Started up JIRA 4.0.2
            2. Created a new "Text Field (< 255 characters)" custom field called "weekField".
            3. Reindexed JIRA as instructed.
            4. Created an issue (TST-1) with weekField set to "week-2010-11-15".
            5. Created an issue (TST-2) with weekField set to "week-2010-11-14".
            6. Ran the JQL search weekField ~ "week-2010-11-15". I only got TST-1.
            7. Ran the JQL search weekField ~ "week-2010-11-14". I only got TST-2.
            8. Ran the JQL search weekField ~ "week". I got nothing.

            Am I doing something different to you? Also what is your indexing language set to?

            I did want to mention that using "Text" fields for exact matching in JIRA is a bad idea. JIRA processes all the text within a "text" fields that will generally make exact matching impossible. Can you use the date picker custom field instead?

            Regards,
            Brenden.

            bain added a comment - Hello Andrew, I was unable to reproduce this problem. Here is what I did: Started up JIRA 4.0.2 Created a new "Text Field (< 255 characters)" custom field called "weekField". Reindexed JIRA as instructed. Created an issue (TST-1) with weekField set to "week-2010-11-15". Created an issue (TST-2) with weekField set to "week-2010-11-14". Ran the JQL search weekField ~ "week-2010-11-15". I only got TST-1. Ran the JQL search weekField ~ "week-2010-11-14". I only got TST-2. Ran the JQL search weekField ~ "week". I got nothing. Am I doing something different to you? Also what is your indexing language set to? I did want to mention that using "Text" fields for exact matching in JIRA is a bad idea. JIRA processes all the text within a "text" fields that will generally make exact matching impossible. Can you use the date picker custom field instead? Regards, Brenden.

              Unassigned Unassigned
              2dbd9d9b96a7 Andrew Chernyshov
              Affected customers:
              0 This affects my team
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: