You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ronja Koistinen <ro...@helsinki.fi> on 2019/05/13 08:14:09 UTC

Invalid Date Math Strings silently fail in q, not in fq

Hello,

I encountered an issue where invalid dates throw an exception when they
are in an fq parameter but are silently dropped when in q. For example:

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":4,
    "params":{
      "q":"visible_date:[2019-01-01T00:00:00Z TO 2019-12-31T23:59:99Z]",
      "defType":"edismax",
      "df":"text",
      "fl":"visible_date",
      "wt":"json",
      "debugQuery":"on",
      "stopwords":"true"}},
  "response":{"numFound":0,"start":0,"docs":[]
  },
  "debug":{
    "rawquerystring":"visible_date:[2019-01-01T00:00:00Z TO
2019-12-31T23:59:99Z]",
    "querystring":"visible_date:[2019-01-01T00:00:00Z TO
2019-12-31T23:59:99Z]",
    "parsedquery":"+()",
    "parsedquery_toString":"+()",
    "explain":{},
    "QParser":"ExtendedDismaxQParser",
    "altquerystring":null,
    "boost_queries":null,
    "parsed_boost_queries":[],
    "boostfuncs":null,
    --snip--

Above the parsedquery is empty because the timestamp
2019-12-31T23:59:99Z is invalid.

However:

{
  "responseHeader":{
    "zkConnected":true,
    "status":400,
    "QTime":2,
    "params":{
      "q":"*:*",
      "defType":"edismax",
      "df":"text",
      "fl":"visible_date",
      "fq":"visible_date:[\"2019-01-01T00:00:00Z\" TO
\"2019-12-31T23:59:99Z\"]",
      "debugQuery":"on",
      "stopwords":"true",
      "_":"1557734718206"}},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","java.time.format.DateTimeParseException"],
    "msg":"Invalid Date in Date Math String:'2019-12-31T23:59:99Z'",
    "code":400}}

Above the date range filter is in fq, and now a DateTimeParseException
is thrown.

Is it intended behaviour that in a q parameter date filters are silently
dropped on parsing errors while in an fq parameter an exception is
thrown? Or is this a bug?

I am running Solr version 7.7.1.

-- 
Ronja Koistinen
IT Specialist
University of Helsinki