From ecommerce platforms to Content Management Systems (CMSs), web apps generate and handle enormous amounts of data. Extracting relevant information from this data efficiently is crucial for a seamless user experience. So, traditional search functionality that uses literal, word-for-word query matching doesn’t suffice. You need a full-text search.

A full-text search examines the complete content of documents or databases, allowing you to retrieve relevant information from large datasets based on specific words or phrases. It accounts for factors like frequency of occurrence and multilingual content, yielding more accurate and comprehensive search results.

Meilisearch is a frontrunner in this class of search engines, harnessing the power of full-text search to offer a flexible and powerful tool built with developers and end users in mind.

This tutorial demonstrates how to integrate Meilisearch into a Node.js web project.

What Is Meilisearch?

Meilisearch is an open-source search engine that provides fast, relevant search results for end users. It’s typo-tolerant and works out of the box with default settings to accommodate most projects.

Meilisearch is also highly customizable, offering numerous features to tune the relevance of search results. Among these features, the most notable is ranking rules, which you can tailor to suit your project.

It offers an intuitive RESTful API for seamless integration into virtually any business website. You can host it yourself or use its official cloud-hosted solution, Meilisearch Cloud, to get started quickly and effortlessly. This tutorial uses Meilisearch Cloud.

Prerequisites

To follow along, you need:

How To Set Up Meilisearch

  1. Navigate to Meilisearch Cloud and either create an account or log in. Ensure you confirm your email address.
  2. Next, click Create a project, a server running a Meilisearch instance — where you’ll add your website’s datasets.
  3. Add a Project name (for example, book-app) and choose your preferred region. Then, click Create. After creating your project, you can click Settings to see details about your project, like the URL for accessing the datasets, API keys for protecting your Meilisearch instance, and other information.
    The book-app project overview page.

    There are three API keys, each representing a different authorization level:

    • Master key — This key unlocks all routes and is the only one with access to endpoints for creating and deleting API keys. Only use the master key to manage API keys from a protected environment.
    • Default Search API key — This key only grants access to the search route. You can use it in the client-side code.
    • Default Admin API key — This key accesses all API routes except /keys, which is for creating and deleting API keys. You can only use this key from a protected environment.

How To Index Data With Meilisearch

Indexes are the core components that store and organize searchable data. They act as containers for documents — objects containing one or more fields.

Each index in Meilisearch is independent and customizable, allowing for individualized search ranking rules and filtering options.