Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9085

DateRangeField is broken before the year 1582

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 6.0.1, 6.1
    • Component/s: None
    • Labels:
      None

      Description

      DateRangeField has some issues for dates before 1582 (the Gregorian Change Date), following Solr 6. The main problem is that it uses DateMathParser which no longer observes a GCD and then it converts that Date to a Calendar using Calendar.setTime(date) which considers the GCD. We can't altogether avoid Calendar.java as in SOLR-9080 because DateRangePrefixTree currently fundamentally depends on it. However I recently learned we can simply change the GCD like so: cal.setGregorianChange(new Date(Long.MIN_VALUE)); beforehand. DateRangeField also calls Calendar.getTime as well, which is affected by GCD considerations.

      For users that use DateRangeField but do not use "Date Math" and do not have 'Z' in their date strings then date strings are completely parsed by DateRangePrefixTree and there should be no issue.

      DateRangePrefixTree ought to be improved a bit too (in a separate issue)... like making the GCD configurable, and setting using SimpleDateFormatter.setCalendar it uses to format.

      1. SOLR-9085.patch
        6 kB
        David Smiley

        Issue Links

          Activity

          Hide
          dsmiley David Smiley added a comment -

          I files LUCENE-7278 to make the template Calendar configurable, including a sample instance with no GCD. Here I enhance DateRangeField to use that, and added tests of course. This issue also depends on SOLR-9080

          Show
          dsmiley David Smiley added a comment - I files LUCENE-7278 to make the template Calendar configurable, including a sample instance with no GCD. Here I enhance DateRangeField to use that, and added tests of course. This issue also depends on SOLR-9080
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4193e60b9fc1ff12df2267778213ae3b0f04fb84 in lucene-solr's branch refs/heads/master from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4193e60 ]

          SOLR-9080 SOLR-9085: Fix date math before the year 1582.
          note: DateMathParser no longer needs a Locale

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4193e60b9fc1ff12df2267778213ae3b0f04fb84 in lucene-solr's branch refs/heads/master from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4193e60 ] SOLR-9080 SOLR-9085 : Fix date math before the year 1582. note: DateMathParser no longer needs a Locale
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 9d826ffa2f767d5e75f0844531a5c194b0c04034 in lucene-solr's branch refs/heads/branch_6x from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9d826ff ]

          SOLR-9080 SOLR-9085: Fix date math before the year 1582.
          note: DateMathParser no longer needs a Locale
          (cherry picked from commit 4193e60)

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9d826ffa2f767d5e75f0844531a5c194b0c04034 in lucene-solr's branch refs/heads/branch_6x from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9d826ff ] SOLR-9080 SOLR-9085 : Fix date math before the year 1582. note: DateMathParser no longer needs a Locale (cherry picked from commit 4193e60)
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8309bae5ff11c6c9e5835c60b6f8b08bd810737d in lucene-solr's branch refs/heads/branch_6_0 from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8309bae ]

          SOLR-9080 SOLR-9085: Fix date math before the year 1582.
          note: DateMathParser no longer needs a Locale
          (cherry picked from commit 4193e60)
          (cherry picked from commit 9d826ff)

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8309bae5ff11c6c9e5835c60b6f8b08bd810737d in lucene-solr's branch refs/heads/branch_6_0 from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8309bae ] SOLR-9080 SOLR-9085 : Fix date math before the year 1582. note: DateMathParser no longer needs a Locale (cherry picked from commit 4193e60) (cherry picked from commit 9d826ff)
          Hide
          steve_rowe Steve Rowe added a comment -

          Bulk close issues included in the 6.0.1 release.

          Show
          steve_rowe Steve Rowe added a comment - Bulk close issues included in the 6.0.1 release.

            People

            • Assignee:
              dsmiley David Smiley
              Reporter:
              dsmiley David Smiley
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development