Meilisearch is a fast, open-source search engine that provides typo tolerance, relevance ranking, faceted filtering, and sub-50ms search responses. Spree includes a built-in Meilisearch search provider that replaces the default SQL-based search.When to use Meilisearch:
brew install meilisearchmeilisearch# Running at http://localhost:7700 — no API key needed for development
For local development, Meilisearch runs without authentication by default — no API key is needed. For production, set a master key (minimum 16 bytes) via MEILI_MASTER_KEY when starting Meilisearch. Use this master key as your MEILISEARCH_API_KEY.
# .env# Local development — no API key neededMEILISEARCH_URL=http://localhost:7700# Production — use the master key you set when starting Meilisearch# MEILISEARCH_API_KEY=your-master-key-min-16-bytes
Products are indexed as one document per market × locale combination. Each document contains the product’s name and description in that locale, the price in that market’s currency, and all non-translated fields (categories, options, stock, tags).For example, a store with a US market (USD, English) and an EU market (EUR, German/French) creates 3 index documents per product:
Document ID
Name
Price
Locale
Currency
prod_abc_en_USD
Blue Shirt
29.99
en
USD
prod_abc_de_EUR
Blaues Hemd
27.50
de
EUR
prod_abc_fr_EUR
Chemise Bleue
27.50
fr
EUR
Products are only indexed for markets where they have a price. If a product has no EUR price, no EUR documents are created.Translations use Mobility with fallback — if a product has no German translation, the default locale (English) is used.Each document includes:
Translated name, description, slug
Price and compare-at price in the market’s currency
GET /api/v3/store/products?q[search]=shirt&q[price_gte]=20&sort=price
Controller builds AR scope for security: store.products.active(currency).accessible_by(ability)
Meilisearch provider adds base filters: locale='en' AND currency='USD' AND status='active' AND store_ids='{id}' AND not_discontinued
Provider sends one Meilisearch API call: search + user filters + facets + sort + pagination
Provider intersects Meilisearch product IDs with AR scope (safety net)
Returns products + facets with adjusted counts + pagination
The base filters ensure Meilisearch only returns products visible in the current locale and currency. The AR scope is a safety net — it should not filter out any additional products.