Search things to reserve based on a date range when they are available

Hello,
we are building an app in react -native, firebase and Algolia where we need to search for assets that are reserved by people. We would lke to apply a date range filter where we say it should be available between data A and B and the search should only return those assets where there is no reservation between data A and B. Both the asset and the reservation are separate collections in Firestore.

We have been searching around but can’t find the solution, but we are also very new to Algolia so maybe we miss something.

Can anyone point us in the right direction. Now, to make things work, we are doing things front-end. `

Thank you very much for any help!

Tim

Hi Tim!

When you’re sending search requests to Algolia, you can add filters on some attributes to refine the search. Algolia lets you filter on numeric values, which perfectly apply to dates as long as they’re in the right format. Here’s a guide on how to filter by date, using UTC timestamps.

If you’re building a React Native application, then you can use our React InstantSearch library to build your front end. We have RangeInput and a RangeSlider widgets that may fit your needs.

Note that since the library is primarily for React on the web, the built-in widgets aren’t compatible as is with React Native. You’ll need to use connectors (which take care of the logic) and implement the render yourself. You can learn more about it here.

Best,