Hi Solr Fans,

I am trying to figure out how to use the parse-date processor for pdates.

I am able to insert data with this python code to a solr collection/core:

solr = pysolr.Solr('http://localhost:5555/solr/core1', timeout=10)

solr.add([
{
   "t":             '2017-08-19T21:00:42.043Z',
}
])
solr.commit()

My schema.xml has the following lines:

<fieldType name="pdate"  class="solr.DatePointField" docValues="true"/>
<fieldType name="pdates" class="solr.DatePointField" docValues="true"
multiValued="true"/>
<field name="t"             type="pdate"   indexed="true" stored="true"/>

This makes sense as DatePointField requires a pretty strict date/time
formatting:
http://lucene.apache.org/solr/7_2_1/solr-core/org/apache/solr/schema/DatePointField.html


I am trying to figure out how to use the parse-date parser to allow more
flexible formattings. My solrconfig.xml has the following lines:

<updateProcessor class="solr.ParseDateFieldUpdateProcessorFactory"
name="parse-date2">
<arr name="format">
<str>yyyy-MM-dd HH:mm:ss.SSS</str>
</arr>
</updateProcessor>

 <updateRequestProcessorChain default="true">
<processor class="solr.UUIDUpdateProcessorFactory">
<str name="fieldName">id</str>
</processor>
<processor name="parse-date2">
<str name="fieldName">t</str>
</processor>

    <processor class="solr.LogUpdateProcessorFactory" />
    <processor class="solr.RunUpdateProcessorFactory" />
  </updateRequestProcessorChain>

How should I automatically invoke the parser for the t field? Currently, I
am getting an error:

2019-09-03 12:11:37 Solr responded with an error (HTTP 400): [Reason:
ERROR: [doc=c19c7d74-b81f-4575-ac5d-9c6aeeb82496] Error adding field
't'='2017-08-19 21:00:42.043' msg=Invalid Date String:'2017-08-19
21:00:42.043']

if I add the doc with this timestamp:

        self.solr.add([
        {

                "t":             '2017-08-19 21:00:42.043'

        }
        ])
        self.solr.commit()

Cheers,
Arturas

Reply via email to