- Issue created by @diegopino
- π©πͺGermany mkalkbrenner π©πͺ
Isn't that exception the correct behaviour if the value could not be parsed?
Simply silently skipping the value seems wrong to me.Can you provide a list of examples that are valid drupal field values, but result in a parse error?
- πΊπΈUnited States diegopino
Thanks for your reply @mkalkbrenner.
The exception thrown at the backend/index level is not in question, at least as a last resort given that on a date out of range date time range we are sending a "[ TO ]" to solr, which is wrong . From a perspective of an user indexing data, it is not something and enduser can act on to correct the issue (or conform to date/time limitations of Drupal, which are not Solr limitations for date range values). Also it is not "silent", the date time parser will already log that the date could not be parsed.
But I think my point is valid because the code is already doing what I believe is the right behavior (and the proposed solution) for dates here
https://git.drupalcode.org/project/search_api_solr/-/blob/4.x/src/Plugin...
case 'date': $value = $this->formatDate($value); if ($value === FALSE) { continue 2; } break;
So it would not hurt to do
case 'solr_date_range': $start = $this->formatDate($value->getStart()); $end = $this->formatDate($value->getEnd()); if ($start === FALSE || $end === FALSE) { continue 2; } $value = '[' . $start . ' TO ' . $end . ']'; break;
Thanks.
- π©πͺGermany mkalkbrenner π©πͺ
You're right. We should be consistent here an provide a corresponding patch.
Nevertheless, some examples would be good. Or even better, a test.
- πΊπΈUnited States diegopino
I will make a fork/patch this week. I want to better understand what are the date time class limits of Drupal for a test (and will provide a test too once I do so).
We work with Cultural heritage( so our dates can span thousands if not million years into the past when dealing with archeological/paleontological artifacts) and for that we use custom fields/proper Drupal typed data sub properties based https://github.com/ProfessionalWiki/EDTF parsing, so not Drupal UI normal input values you might find in standard Drupal websites.
The values are correct 64bit PHP dates though. Just to be clear, not asking for support of those dates (would require a complete overhaul of Drupal's time logic), just to handle them as other dates are being handled
Thanks a lot for your feedback and time to review my issue