The official Meilisearch backend for Drupal's Search API: self-hosted or Meilisearch Cloud, with Views, Facets and highlighting.
- Drupal 10.3 or 11, PHP 8.1+
- Search API 1.39+
- Meilisearch 1.16+ (self-hosted) or a Meilisearch Cloud project
The module is in alpha, so Composer needs the @alpha flag:
composer require 'drupal/meilisearch:^1.0@alpha'
drush en meilisearch -yUsing Meilisearch Cloud? See docs/guides/meilisearch-cloud.mdx.
Meili Kitchen is a recipe search demo built with this module: clone it and run docker compose up --build.
- Configuration → Search and metadata → Search API → Add server: pick the Meilisearch backend, enter the URL with its port (
http://127.0.0.1:7700, or your Cloud project URL) and an API key. - Add an index on that server, pick content and fields, then Index now.
- Build a view on the index with a fulltext filter.
Keep the API key out of configuration exports by setting it in settings.php:
$config['search_api.server.SERVER_ID']['backend_config']['api_key'] = getenv('MEILISEARCH_API_KEY');Use a dedicated key with the search, documents.*, indexes.*, settings.*, tasks.get and version actions rather than the master key.
- Typo-tolerant, prefix-matching full-text search; keyword, hybrid or semantic mode
- Every Search API condition, including language (
setLanguages()) and datasource filters - Facets (Facets): limits, minimum counts, missing values, OR facets
- Highlighted, cropped and escaped excerpts (Meilisearch highlighting processor)
- Location search with Search API Location
- Exact result counts, ranking scores, magic-field sorts
- Index prefixes, so sites and environments can share one instance
meilisearch_analyticssubmodule: click analytics on Meilisearch Cloudhook_meilisearch_search_params_alter()andhook_meilisearch_request_headers_alter()
Synonyms, stop words, ranking rules and embedders are Meilisearch settings: manage them in the Cloud dashboard, the CLI or the API. The module only sends the attribute lists, pagination and faceting limits, and makes sort the first ranking rule of the indexes it creates so explicit sorts are strict.
- No boolean operators in keywords: parsed keys are flattened, the matching strategy decides how many words must match, negated keys become
-word. - The last word matches as a prefix and typos are tolerated.
- Conditions and facets on fulltext fields use whole field values.
- Exact conditions on string values over about 250 bytes cannot match.
- Random sorting is not supported; "relevance, then X" with keywords is relevance order.
Details: docs/reference/search-behavior.mdx.
The docs/ directory is a Mintlify site:
cd docs && npx mintlify devTests run against a real Meilisearch, including Search API's backend conformance suite:
scripts/test.shSee docs/reference/development.mdx.
GPL-2.0-or-later
