Meilisearch for Beginners: Search That Feels Instant
Users expect search to work like Google: type two letters, get results, typos forgiven. Building that with a SQL LIKE query is painful. Meilisearch is an open-source search engine, written in Rust, that gives you typo-to
Users expect search to work like Google: type two letters, get results, typos forgiven. Building that with a SQL LIKE query is painful. Meilisearch is an open-source search engine, written in Rust, that gives you typo-tolerant, instant search with almost no configuration.
You send it documents, and it indexes them:
import { Meilisearch } from 'meilisearch';
const client = new Meilisearch({ host: 'http://localhost:7700' });
// Add documents (an API key protects this in production)
await client.index('movies').addDocuments([
{ id: 1, title: 'The Shawshank Redemption', year: 1994 },
{ id: 2, title: 'The Godfather', year: 1972 },
]);
// Search β typos and all
const results = await client.index('movies').search('godfathr');
console.log(results.hits); // finds "The Godfather"
That typo tolerance is built in, along with ranking, faceted filtering, and highlighting of matched words. There is no schema to define and no mapping to tune β Meilisearch figures out the fields from your documents.
For a frontend, you can query Meilisearch directly from the browser with a search-only API key, or proxy it through your backend. It also has official SDKs for JavaScript, Python, Go, and more, and a hosted cloud option if you do not want to run the server yourself.
Meilisearch is for developers adding search to a blog, a store, a docs site, or a dashboard β anywhere a database LIKE query is too slow and Elasticsearch is too much. If your users search for things in your app, this is one of the fastest ways to make that search feel great.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.