Solr
  1. Solr
  2. SOLR-1811

DataImportHandler: dataimporter.functions.formatDate should have a redefined concept of NOW for each import

    Details

      Description

      "The first argument can be a computed value eg: '$

      {dataimporter.functions.formatDate('NOW-3DAYS', 'yyyy-MM-dd HH:mm')}

      ' and it uses the syntax of the datemath parser in Solr." When using a relative date with NOW, NOW is set with teh first full-import but not with subsequent imports. NOW should be redefined with each new import.

      1. SOLR-1811.patch
        0.7 kB
        Noble Paul
      2. SOLR-1811.patch
        1 kB
        Sean Timm

        Activity

        Hide
        Noble Paul added a comment -

        it is computed just in time . What suggests you that it is not?

        Show
        Noble Paul added a comment - it is computed just in time . What suggests you that it is not?
        Hide
        Sean Timm added a comment -

        Looking at the query sent to MySQL, I see that the time doesn't change from the first invocation. Looking at the code, it looks like EvaluatorBag.dateMathParser.setNow(new Date()); is never called. I fixed it locally. I'll upload a patch shortly for you to look over.

        Show
        Sean Timm added a comment - Looking at the query sent to MySQL, I see that the time doesn't change from the first invocation. Looking at the code, it looks like EvaluatorBag.dateMathParser.setNow(new Date()); is never called. I fixed it locally. I'll upload a patch shortly for you to look over.
        Hide
        Noble Paul added a comment -

        I guess I got it. I am reusing the DatemathParser instance. Which caches the now value. We should create anew instance always so that the Evaluator is threadsafe

        Show
        Noble Paul added a comment - I guess I got it. I am reusing the DatemathParser instance. Which caches the now value. We should create anew instance always so that the Evaluator is threadsafe
        Hide
        Noble Paul added a comment -

        committed r925091
        Thanks Sean

        Show
        Noble Paul added a comment - committed r925091 Thanks Sean

          People

          • Assignee:
            Noble Paul
            Reporter:
            Sean Timm
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development