On 11/13/2019 10:07 AM, rhys J wrote:
I have date fields in my documents that are just YYYY-MM-DD.
<fieldType name="pdate" class="solr.DatePointField" docValues="true"/>

and

<field name="next_contact_date" type="pdate" uninvertible="true"
sortMissingLast="true" indexed="true" stored="true"/>

When I use the API to do a search and try:

2018-01-01
[2018-01-01 TO NOW]

I get 'Invalid Date String'.

Did I type my data wrong in the schema? Is there something I'm missing from
the field itself?

According to this page, I should be able to query on just YYYY or YYYY-MM
or YYYY-MM-DD.

With DatePointField, you must use full date strings, that include time down to the second. Here's an example.

2018-01-01T00:00:00

If you use DateRangeField instead of DatePointField for your field's class, then you can indeed use partial timestamps for both indexing and querying. This only works with DateRangeField.

Thanks,
Shawn

Reply via email to