Building A Multi-Search with Meilisearch & AdonisJS

In this series, we'll build a server-rendered mutli-search utilizing Meilisearch, Unpoly, and a sprinkle of AlpineJS. We'll setup factories and seeders to make fake data to allow us to index and search against books, authors, and genres simultaneously!

Difficulty Intermediate
What's Inside 12 Lessons
Viewing Time 1h 38m
Sign up to save progress
1

What We'll Be Building

In this series, we'll be building a completely server-rendered multi-search using Meilisearch, Unpoly, and a little AlpinzeJS. We'll setup the open-source version of Meilisearch locally, setup seeders and factories to build fake data to index, and more!

2m 48s

Meilisearch Installation & Setup

In this lesson, we'll focus on installing and setting up the open-sourced version of Meilisearch locally on our machine for use throughout this series.

5m 15s

Creating our AdonisJS Project & Setting Up our API Keys

In this lesson, we'll create our AdonisJS project and utilize our Jumpstart helper to bypass some set up work and keep the series on topic. We'll then integrate our Meilisearch API Keys into our project so they're ready to go!

7m 37s

Creating our Database Migrations, Models, and Factories

In this lesson, we'll work on structuring our database by defining our migrations, Lucid models, and model factories to aide in generating fake data we'll later index and search against with Meilisearch.

10m 27s

Seeding Fake Data to Index for our Multi-Search

In this lesson, we'll create a database seeder that will utilize our model factories to generate plenty of fake data to index and search against. We'll also discuss how we can easily batch insert bulk data in a single call.

13m 9s

Creating A Meilisearch Service to Initialize Admin & Search Instances

In this lesson, we'll create a singleton Meilisearch service to simplify operations against our Meilisearch database by allowing us to specify whether we want to simply search or perform an admin authorized operation.

5m 49s

Creating a Command to Index Data in Meilisearch

In this lesson, we'll create an Ace CLI command to index our pre-existing data within our Meilisearch database so it is ready to search against. We'll walk our way through this and point out what to watch out for and how to view task errors.

19m 0s

Performing Full-Text Search

In this lesson, we'll learn how to perform a full-text search with Meilisearch while also building the structural base for what will eventually serve as our multi-search autocomplete.

9m 9s

Making our Search Results Functional with Unpoly

In this lesson, we'll install and configure Unpoly to handle our search form's submission. We'll then server-render the search's results using EdgeJS and return it back as our response for Unpoly to swap in-place directly in the working document.

8m 38s

Performing a Multi-Search Across Indexes

In this lesson, we'll piece everything together into our final multi-search by searching across our book, genre, and author indexes within Meilisearch with a single call. We'll also discuss how we can get a single federated result array back if desired.

9m 41s

Indexing Data as its Created

In this lesson, we'll learn how we can dynamically index documents in Meilisearch as records are created within our application. For this, we'll index a new author document when a user registers within our application.

2m 39s

Removing Indexed Documents when they're Deleted

In this lesson, we'll learn how we can remove documents from a Meilisearch index as records are deleted from our application. For this, we'll deindex author documents when a user deletes their account in our application.

4m 29s