Implementation Process
On this page
Implementing Algolia can be broken down into a 4-step process:
- Indexing data
- Configuring relevance
- Building the search user interface
- Iterating using Algolia Analytics
Indexing Data
Algolia provides a JSON based REST API for indexing data. This means all data pushed to an Algolia index must be sent as JSON. To make indexing easier, API clients have been developed for most major languages. Additionally, if you would like to test a static subset of your data, you can upload a JSON file directly via our dashboard.
Indexing is not a one time thing. Once your initial data has been indexed, you will want to configure your application to sync your database changes such as additions, updates, and deletions with your indices in Algolia.
It is important when indexing your data to choose which fields should be included. You only want to index data needed for searching, displaying, filtering, and ranking. All other data points not needed for these cases should be excluded in order to keep your index optimized.
Configuring Relevance
Algolia provides many ways to configure your index and fine-tune your overall index relevancy. The most important settings to configure are the searchable attributes and the custom ranking attributes. Beyond these, Algolia has pre-set many sensible defaults that should work for most use cases. However, you may find your data set requires further configuration tweaking.
Searchable Attributes
The searchable attributes field controls which record attributes can be found by querying. It should be noted that the order of this setting matters - attributes at the top of the list are considered more important.
Custom Ranking Attributes
Algolia’s default ranking includes a custom ranking field which allows you to add business metrics to the relevance calculation. This means you can leverage any numerical or boolean attributes in your data to customize your relevancy. For example, you might consider adding availability or popularity information to ensure in stock and popular items are ranked highest.
Creating a Search Experience
Once your data has been indexed and your indices properly configured, the final step is to implement search within your site or application.
User Interface
What type of user experience you create is entirely flexible - Algolia can power a wide array of potential search patterns. The response returned when you query Algolia is JSON, which allows you to easily consume the search results programmatically and craft any type of experience. The response contains a breadth of useful information, even just beyond the basic matching results: total number of matches, pagination, computed facets, highlighting, and more.
Querying Algolia
Searches performed on Algolia indices consist of a full-text query along with zero or more optional parameters. Optional parameters can be used to override configured settings so you can change the behavior of specific searches while not impacting others. For example, you might choose to retrieve more results for certain queries, but limit this number otherwise.
We highly recommend issuing all search requests directly from the end user’s browser, mobile device, or client. It will reduce the overall search latency, and thus allow you to provide an instant “find as you type” experience to your users - offloading your servers at the same time.
Iterating using Algolia Analytics
You can iterate on your implementation by making use of Algolia’s out-of-the-box analytics or implementing Click and Conversion Analytics. These analytics are the foundation for more advanced features like A/B testing, Personalization, and Dynamic Re-Ranking