Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/428#discussion_r208249177
--- Diff:
solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java
---
@@ -232,23 +220,22 @@ public void testParseFrenchDate() throws Exception {
assertNull(schema.getFieldOrNull("not_in_schema"));
String frenchDateString = "le vendredi 15 janvier 2010";
String dateString = "2010-01-15T00:00:00.000Z";
- DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTime();
- DateTime dateTime = dateTimeFormatter.parseDateTime(dateString);
SolrInputDocument d =
processAdd("parse-french-date-UTC-defaultTimeZone-no-run-processor",
doc(f("id", "88"), f("not_in_schema",
frenchDateString)));
assertNotNull(d);
assertTrue(d.getFieldValue("not_in_schema") instanceof Date);
- assertEquals(dateTime.getMillis(),
((Date)d.getFieldValue("not_in_schema")).getTime());
+ assertEquals(Instant.parse(dateString),
((Date)d.getFieldValue("not_in_schema")).toInstant());
}
public void testFailedParseMixedDate() throws Exception {
IndexSchema schema = h.getCore().getLatestSchema();
assertNull(schema.getFieldOrNull("not_in_schema"));
- DateTimeFormatter dateTimeFormatter =
ISODateTimeFormat.dateOptionalTimeParser().withZoneUTC();
+ DateTimeFormatter dateTimeFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd['T'HH:mm][:ss.SSSz]",
Locale.ROOT).withZone(ZoneOffset.UTC);
--- End diff --
This particular dateTimeFormatter shows up in a bunch of places in this
test, so I'll put it in a field constant. Likewise I'll add a simple
parse(DateTimeFormatter, String dateString) method to reduce duplication of
specifying so many date time objects in parseBest.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]