This module enhances Search API search results by adding AI-generated synonyms and search intent phrases. It processes content in the background, stores the AI-generated text in a local cache, and then injects it into your search index without needing a vector database. This allows for more intelligent semantic search directly from your standard relational database.
The AI Semantic Expansion module enriches your Search API indexes with AI-generated synonyms and search intent phrases, enabling semantic search on standard relational databases (MySQL, MariaDB, PostgreSQL) — no vector database required.
When a node is saved, the module queues it for processing. A background queue worker sends the node's content to your configured LLM provider (via the Drupal AI module) and stores the generated synonym text in a local cache table. During Search API indexing, the processor injects that cached text into a virtual field (ai_semantic_synonyms), which can be mapped and boosted like any other fulltext field.
Key features
- Zero live HTTP calls during indexing. All AI generation happens in the background queue worker; the Search API processor only reads from the local cache.
- Hash-based deduplication. The cache row is only regenerated when the source content actually changes, preventing redundant API calls.
- Provider-agnostic. Works with any chat-capable provider configured in the Drupal AI module (OpenAI, Anthropic, Ollama, and others).
- Configurable per index. Source fields, character limit, system prompt, and AI provider are all set on the Search API processor configuration form.
- Bulk pre-warm command. Run
drush ai-expand:batchto pre-populate the cache for all existing nodes before the first indexing run. - Cache management. A “Flush AI cache” button on the processor form lets administrators clear and regenerate all entries. Changing the LLM prompt automatically invalidates the cache and notifies administrators to re-run the batch command.
Requirements
- Drupal 10.4 or 11
- Drupal AI module with at least one chat-capable provider configured
- Search API module with an active index
Installation
- Enable the module:
drush en ai_semantic_expansion - Run database updates:
drush updb - Go to your Search API index → Processors and enable AI Semantic Expansion.
- Go to Fields and add the AI Semantic Synonyms virtual field; set its type to Fulltext and apply a boost weight.
- Pre-warm the cache for existing content:
drush ai-expand:batch - Re-index:
drush search-api-index
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the AI ecosystem
Most installed first
Activity
Release Timeline
Releases
| Version | Type | Core | Release date | |
|---|---|---|---|---|
| 1.0.0-alpha3 | Pre-release | 10–11 | May 19, 2026 | |
| 1.0.0-alpha2 | Pre-release | 10–11 | May 19, 2026 | |
| 1.x-dev | Dev | 10–11 | May 19, 2026 | |
| 1.0.0-alpha1 | Pre-release | 10–11 | May 19, 2026 |