Searching from the front-end or the back-end? What do you recommend?
We highly recommend front-end search.
Speed
A front-end implementation hits our servers directly, without going through your back end. It can be up to 10x faster for the end user to retrieve results.
DSN
We provide a distributed API, allowing you to select multiple data centers around the world. This lets your users target the closest server, which has a significant impact on latency. This can only work with a front-end implementation.
Availability
With a back-end implementation, you’re forcing some network routes. Even if there’s only a local problem in the network, this affects all users. Using a front-end implementation means that only a subset of your users are affected when there’s a network issue.
What is front-end search?
What type of user experience you create is entirely flexible—Algolia can power a wide array of potential search patterns. When you query Algolia, the engine returns a JSON response, which allows you to consume the search results easily and craft any experience. The response contains a breadth of useful information beyond matching results. You get access to the total number of matches, pagination, computed facets, highlighting, and more.
All this can be done directly from the machine of the end user, using JavaScript. With this approach, your front-end code communicates directly with our servers, bypassing yours. In other words, you can build UI components, capture user input, contact our servers, and display the results right in the client. This is what we mean by front-end search.
Take a look at our InstantSearch UI libraries for more detail, including code samples and a widget showcase.
So, while your server remains responsible for many Algolia-related activities—like importing and updating data or configuring indices—it doesn’t need to get involved in the search experience.
If you feel like a back-end implementation would still work better in your case, don’t hesitate to get in touch with us.