Searching for Availability

There are several way to search for availability, which ultimately, resolves in using the BAT PHP Library to determine in what state a unit is in over a given period of time.

BAT for Drupal supports out-of-the-box availability searches, integrated with the Search API and the Facet API. This enables you to build a view of search results where availability search is another search facet.


  1. Make sure the BAT Facets module is enabled.
  2. We are going to be using a Search View so the “Search Views” module (bundled with the Search API) needs to be enabled as well.
  3. Finally, for the example, we are going to be using the MySQL Drupal database as a back-end so we will need the Search API Database Search module.

Create an index of types

The BAT Facets module does a search on types of units and presents a type as available over a given date range if there is at least one unit of that type available.

Create a server for meeting rooms:


Create an index of meeting rooms:


Add a Facet on Type ID

Add a facet of the type Type ID


Configure the facet to use the BAT State widget, selecting the event states to return on search. By choosing the Available state, you will get back types that are available (the typical use case), but you can just as easily search for other states.