metacat
metacat copied to clipboard
PortalSubprocessor, collectionQuery & single dates
When creating the collectionQuery field, the PortalSubprocessor needs to escape the ':' characters in single dates, e.g. `datePublished:2008-12-10T00\:00\:00Z'.
The following example collectionQuery (for dev.nceas portal with id:urn:uuid:7021373a-f837-49a4-b2da-7146c3437c3d) shows datePublished:2008-12-10T00:00:00Z which Solr can't parse without escaped ":":
(((datePublished:[2011-09-20T00:00:00Z TO 2012-01-17T00:00:00Z] AND datePublished:2008-12-10T00:00:00Z AND -isSpatial:true) AND (-obsoletedBy:* AND formatType:METADATA)) OR ((-id:8ef8fe8c-eea2-432d-bc81-6f6dc6a6c95f AND -id:urn%5C:uuid%5C:a1ccf30c-025c-467d-98c2-fac4c71cd5b9) OR (id:urn%5C:uuid%5C:5d989a9e-285b-4419-ae9a-c9e595b087a4 AND id:urn%5C:uuid%5C:8b658d37-2b33-4b61-8dd8-8d250e1c42e3)))
The error for this, issued by Solr:
org.apache.solr.common.SolrException: Invalid Date String:'2008-12-10T00'
Notice that the date range that appears earlier in the query is syntactically valid, as it is surrounded by square brackets, so Solr can parse it correctly.