On 4/15/2018 2:31 PM, Christopher Schultz wrote:
I'd usually call this a "date", but Solr's documentation says that a "date" is what I would call a timestamp (including time zone).
That is correct. Lucene dates are accurate to the millisecond. They don't actually handle timezones the way you might be thinking -- the information is UTC. When using date rounding (NOW/WEEK, NOW/DAY, etc) you can tell Solr what the timezone is so that the boundaries are correct, but the information in the index is UTC.
https://lucene.apache.org/solr/guide/7_3/field-types-included-with-solr. html [ I remember reading but cannot currently seem to find a reference page with the actual pre-defined field types Solr ships with. That page above lists the class names, but not the aliases used by a real Solr installation.
That info is what you need to define the fieldType in the schema. So you would put something like "solr.DatePointField" as the class.
https://lucene.apache.org/solr/guide/7_3/working-with-dates.html
Is there an existing appropriate field type for "date-without-time"?
The answer to this question is not yes, but it's also not no. All date types in Solr have millisecond precision.
But if you use DateRangeField, you can deal with larger time periods. A query like "2018" actually works. At both query and index time, the less precise syntax is translated internally to a *range* before the query or indexing happens.
Thanks, Shawn