Vivere e gustare is a site offering housing reservations in Italy. Users can choose differently equipped accommodations in multiple places. The site had a simple search block but it didn’t offer enough options. Another requirement was to dynamically display the number of results beside each option.
Development - Technical Details
We decided to use Apache Solr. Apache Solr is an open-source search platform, which can handle a large number of complex search requests in a very short time. Apache Solr was integrated into Drupal with Search API, which provides an abstract framework for creating searches. With views, we created the text and date filters, and exposed them on the front page. Part of the filters were provided by Search API, so we had to alter the exposed search block. The filters on the search page are called facets, and some of them are generated by Search API. For the range facets, we tried the Search API Range module, which was great, apart from a bug that we fixed. There was another issue with displaying non-boolean fields as boolean facets. The solution was to create a new facet type that can check if the value of the field is equal to a predefined string. Checking the boolean facets narrows the result to the nodes where the selected field has the same value as the predefined string. Currently, the site calculates the result count for more than a dozen filters after every search request. Thanks to Apache Solr, these pages load at the same time as all of the other, much simpler pages on the site.