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

DateMath strings truncated to 32 chars by lucene qparser in simple term queries

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1
    • 4.3
    • search
    • None

    Description

      When using the "lucene" QParser, term queries on date fields cause the field value portion of the query clause to be truncated at 32 characters. This can cause visible errors about invalid date math expressions, or may result in silently returning incorrect results if the truncation results in a valid (but incomplete) date math expression.

      For example...

      Example...
      
      last_modified:"2013-03-08T00:46:15Z/DAY+6MONTHS+3DAYS"
      ...truncates to...
      last_modified:"2013-03-08T00:46:15Z/DAY+6MONTHS"
      (silently incorrect)
      
      foo_tdt:"2013-03-10T08:00:00.1Z/MINUTE+6MONTHS"
      ...truncates to...
      foo_tdt:2013-03-10T08:00:00.1Z/MINUTE+6M
      ("Invalid Date Math String" error msg)
      

      This problem does not affect range queries, or queries using either the term or field qparsers...

      Examples that work fine even though the math is longer then 32 chars...
      
      foo_tdt:[2013-03-10T08:00:00.1Z/MINUTE+6MONTHS TO 2013-03-10T08:00:00.1Z/MINUTE+6MONTHS]
      
      {!term f=bday}1976-07-04T12:08:56.45Z/SECOND+235MILLIS
      foo_tdt:"2013-03-10T08:00:00.1Z/MINUTE+6MONTHS"
      
      Original problem report

      DateMathParser doesn't work correctly.
      http://lucene.apache.org/solr/4_1_0/solr-core/org/apache/solr/util/DateMathParser.html

      fq=last_modified:"2013-03-08T00:46:15Z/DAY+6MONTHS+3DAYS"

      expected; last_modified:2013-09-11T00:00:00Z
      actual; last_modified:2013-09-08T00:00:00Z

      Attachments

        1. SOLR-4538_test.patch
          3 kB
          Chris M. Hostetter
        2. SOLR-4538.patch
          2 kB
          Yonik Seeley
        3. SOLR-4538.patch
          7 kB
          Chris M. Hostetter

        Activity

          People

            hossman Chris M. Hostetter
            minoru Minoru Osuka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: