Inclusive Range Search


I am looking for some guidance around developing a date range search for events with a slightly different behaviour to the norm - it will be inclusive.

What that means is that the constraints will be relaxed. It will include events that start before the specified range and end after the specified range.

To put in in pseudo-code:

if ( event_start >= range_start && event_start <= range_end ) ||
   ( event_end   >= range_start && event_end   <= range_end ) ||
   ( event_start <= range_start && event_end   >= range_end ) {
   // MATCH!

The use case is two-fold:

  1. For an event search where there is some flexibility in dates, so we want to encourage discovery on the dates entered
  2. For events that are ongoing and can be registered for at any point in time

Based on this, it seems the connectRange hits a wall. From what I have researched, the way to do it is with a custom connector.

Would that be the case? If so, any pointers would be appreciated. If not, is there a simpler way to achieve it?

Thank you :slight_smile:

So it seems custom connectors won’t allow the if-&&-|| logic :frowning:

Any ideas or resources from anyone?

I achieved it by importing each date of the event as a separate item in an array, then did a search on that.