I am in the process of updating our system from Solr 4.1.0 to Solr 8.1.4. (Yes, I understand that is not the latest version available, but that is what has been approved for our system).
We regularly submit queries to find documents that "overlap" a time range. Let's say we have indexed fields "starttime_date" and "endtime_date". In case it matters, these fields were indexed as type TrieDateField in Solr 4.1.0, and in Solr 8.1.4 the fields are of type DatePointField.
Part of these "find overlapping documents" queries is to include any document that doesn't have an endtime_date value yet. So, the query would look like this:
(starttime_date:[* TO 2021-02-19T17:00:00.000Z] AND (endtime_date:[2021-02-19T15:00:00.000Z] OR (*:* NOT endtime_date:*)))
This should find all documents that started before 02/19/2021 at 17:00Z, and either haven't ended, or ended before 02/19/2021 at 15:00Z. I have it wrapped in parens here because this group of clauses is almost always "AND"ed with other clauses. Those other clauses are not what I am concerned about for this question.
This solution was built based on this answer to a similar question: https://stackoverflow.com/a/28859224/3586783
This solution worked in Solr 4.1.0, but doesn't appear to work in Solr 8.1.4. As soon as I add the OR (*:* NOT endtime_date:*)
clause, it seems to match all documents. I have tried using -endtime_date:*
, -endtime_date:[* TO *]
, !endtime_date:*
, !endtime_date:[* TO *]
, and none of these have worked.
Is this something related to the change in field type (TrieDateField to DatePointField)? Our query syntax has not changed, but it appears that Solr is processing the query differently now.
Please let me know if more information is needed to understand the issue.