Optimizing search & cutting costs using Meilisearch

By Foster Commerce

Jul 19, 2024

Tech Drop

with Michael Van Dorth, Senior Engineer

We saved our client money, improved performance, and enabled queries on thousands of real estate listings using Meilisearch. This tech drop details our process and why we believe Meilisearch is an ideal option for future client projects.

The project

Additional search functionality allows our client to host a wider range of real estate listings on their website

Our role

Development partner

New feature or functionality

MLS (multi-listing service) real estate properties search pages and results

The journey to find Meilisearch

The journey to find Meilisearch started with our client, Crawford Hoying. Determined to enhance the experience for buyers and renters in their search for the perfect property, Crawford Hoying decided to provide comprehensive real estate listings on their website.

The problem was, their website was syncing data between Craft CMS and a Multiple Listing Service (MLS), utilizing Craft entries and Twig for search operations. While this setup worked adequately for their own properties, adding other real estate listings required a more efficient and scalable solution that could provide fast, accurate search results.

Fortunately, our search for a solution led us to the discovery of Meilisearch. This free open-source search engine promised to handle a larger volume of data. It also ensured uncompromised performance — the perfect answer to meet our client's needs.

Choosing Meilisearch for its speed, price, and scalability

Meilisearch emerged as the ideal solution for Crawford Hoying because of its unique blend of performance, cost-effectiveness, and scalability. Unlike other services like Algolia, which we have used previously, Meilisearch's self-hosting capability was a game-changer.

The adaptability in a self-hosting solution significantly reduces client costs. It also allows us to deploy local instances during development, simplifying the management of indexes across different environments—local, staging, and production.

Furthermore, Meilisearch offers more flexibility in custom sorting without needing multiple "replica" indexes, a common pain point with Algolia.

By hosting Meilisearch on low-cost DigitalOcean Droplets, we achieved excellent performance for thousands of property listings, proving it to be a viable and economical choice for large-scale search functionality.

Integrating Meilisearch into the existing website

The integration of Meilisearch into Crawford Hoying's Craft CMS website infrastructure was a complex process. It involved syncing data across the MLS (via simplyRETS), Craft CMS, and Meilisearch.

We’ve set it up so that Craft CMS is an intermediary, syncing property data from the MLS and other agencies, allowing site admins to enrich listings with additional information and media. This enriched data is then synced to a self-hosted Meilisearch server, providing advanced and performant search and filtering capabilities.

To ensure seamless data sync, we developed a custom plugin that leverages the Meilisearch PHP API. A transformer script within this plugin plays a crucial role, ensuring that every time an entry is saved in Craft, the data is updated in Meilisearch, maintaining real-time synchronization and guaranteeing accurate search results.

To improve site performance and user satisfaction, we sync and query data using the Meilisearch PHP API. This allows initial search results to be rendered server-side for better SEO and subsequent filtering to be handled client-side for enhanced user experience.

This hybrid approach ensures fast, efficient, dynamic search capabilities without frequent server calls.

Meilisearch: A valuable asset in our development toolkit

The decision to incorporate listings from other agencies significantly improved the usefulness of Crawford Hoying's property search feature. This decision could position their site as a comprehensive resource for real estate in the Ohio area.

Improved search via implementation of Meilisearch results in substantial cost savings for Crawford Hoying and significantly enhances the user experience on its website. This dual benefit has increased our optimism and enthusiasm about Meilisearch's benefits. Most importantly, our client is happy to have a robust solution.

For future projects with extensive search requirements, such as ecommerce sites or large property databases, Meilisearch is a compelling option. The cost-effectiveness and performance gains we achieved on this project underscore Meilisearch as a viable choice for other clients seeking scalable and high-performing search functionality.

Our experience demonstrates that we can provide a solution that allows websites to efficiently handle thousands of entries and growing datasets without sacrificing performance, making Meilisearch a valuable and reliable asset in our web development toolkit.

Learn how we can help grow your business.