Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/428#discussion_r207051620
--- Diff:
solr/core/src/java/org/apache/solr/update/processor/ParseDateFieldUpdateProcessorFactory.java
---
@@ -115,9 +123,10 @@ protected Object mutateValue(Object srcVal) {
for (Map.Entry<String,DateTimeFormatter> format :
formats.entrySet()) {
DateTimeFormatter parser = format.getValue();
try {
- DateTime dateTime = parser.parseDateTime(srcStringVal);
- return dateTime.withZone(DateTimeZone.UTC).toDate();
- } catch (IllegalArgumentException e) {
+ TemporalAccessor parsedTemporalDate =
parser.parseBest(srcStringVal, OffsetDateTime::from,
--- End diff --
Shouldn't this be ordered most specific to least specific? Thus Instant
comes first.
Or alternatively, parse to get a temporal accessor, then query to see what
elements of the time are there and not there and build an Instant accordingly.
My most recent patch in https://issues.apache.org/jira/browse/SOLR-12561 shows
this approach. I think this is more efficient since internally there is no
exception. Though perhaps it's less obvious / understandable. Shrug; I wonder
what you think.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]