uschindler commented on code in PR #13075: URL: https://github.com/apache/lucene/pull/13075#discussion_r1478028235
########## lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestIndexSortBackwardsCompatibility.java: ########## @@ -147,6 +150,36 @@ public void testSortedIndex() throws Exception { } } + /** + * Converts date formats for europarl ("2023-02-23") and enwiki ("12-JAN-2010 12:32:45.000") into + * {@link LocalDateTime}. + */ + static Function<String, LocalDateTime> DATE_STRING_TO_LOCALDATETIME = + new Function<>() { + final DateTimeFormatter euroParl = + new DateTimeFormatterBuilder() + .parseStrict() + .parseCaseInsensitive() + .appendPattern("uuuu-MM-dd") + .toFormatter(Locale.ROOT); + + final DateTimeFormatter enwiki = + new DateTimeFormatterBuilder() + .parseStrict() + .parseCaseInsensitive() + .appendPattern("dd-MMM-uuuu HH:mm:ss['.'SSS]") + .toFormatter(Locale.ROOT); + + @Override + public LocalDateTime apply(String s) { + if (s.matches("^[0-9]{4}-[0-9]{2}-[0-9]{2}$")) { + return euroParl.parse(s, LocalDate::from).atTime(LocalTime.MIDNIGHT); Review Comment: `.atStartOfDay()` would be shorter. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org