Wood Chen

Thoughts on Integrating meilisearch into a Movie and TV Website

0 comments134 views421 words

This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文

Background

I'd been using mysql for reads and gorm for searches. Internal lookups for "related titles" were extremely frequent, and I wanted to add "fuzzy matching", "Chinese punctuation handling", "search suggestions", and more to the frontend search. That reminded me of meilisearch, which I'd seen on Douyin a few days earlier. I'd known about this tool, written in rust, for a while, but had never actually used it.

So, with help from claude code, I added meilisearch to https://freedvd.cc for internal lookups, public-facing searches, and more.

General Approach

The website is very simple, with just two categories: "titles" and "people". People include directors and actors.

There are roughly 15.8 × ten thousand title records and around 4.3k people, so the overall dataset is small.

I built the indexes first, then refactored the search and lookup functions to use meilisearch, keeping sql as a fallback.

I started with a full indexing run from an empty index, followed by incremental indexing every hour and a full sync at 1 a.m.

Then I refactored the search methods into a single function, with parameters controlling the different search behaviors.

This approach worked well: a unified function made changes easier, so I updated the people search methods too.

Results

meilisearch uses very few resources and is highly efficient, with busy time typically at 149µs-300µs. It's a bit faster than the previous database queries in go.

Search suggestions are interesting. For example, searching for "Shin Ultraman" can match the candidate "Shin ·Ultraman", making it easier to find what you're looking for.

For "related titles", I replaced the original sequence of querying actor data, then IDs, then titles with a direct title search using the actors' names. That removed unnecessary steps, and I no longer have to worry about scraping.

Besides improving efficiency, I also refactored a lot of unnecessary logic previously written by cursor. Consolidating multiple functions removed hundreds of lines of code and made future changes and maintenance more straightforward.

Gripes

vibe coding really does produce a lot of messy logic. You have to tell it exactly what each function does, how they connect, what interfaces you need, the frontend theme (putting it in claude.md barely helps), and so on. Otherwise, it's a mess: duplicate functionality, unnecessary logic, and tangled steps are inevitable. It might run, but forget about efficiency or maintainability.

meilisearch doesn't support LIKE, and multiple words need to be converted into a 词组, which is a bit strange.

Related posts

Comments 0