For recurrences to work we have to index all occurreces we want to match. This is in conflict of the filtering of dtstart/dtend that we currently do.
The best solution, IMO would be to have a new "daterange" property that stores not only start and end but all periods. This can be from a single point in time to a list of periods. We then base the index and query on that, and thus we can accurately do the querying and filtering.
The tradeoffs are:
- We use extra space to store the daterange (shouldn't be a problem)
- Parsing and filtering the daterange could be relatively expensive. If we generate the daterange for an endlessly recurring event for e.g. 10 years,
we quickly end up with 100's of ranges.
For the time being we just disable filtering by range, so we only have the index on initial query, and no filtering subsequently.