This project is not covered by Drupal’s security advisory policy.

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:batch to 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

  1. Enable the module: drush en ai_semantic_expansion
  2. Run database updates: drush updb
  3. Go to your Search API index → Processors and enable AI Semantic Expansion.
  4. Go to Fields and add the AI Semantic Synonyms virtual field; set its type to Fulltext and apply a boost weight.
  5. Pre-warm the cache for existing content: drush ai-expand:batch
  6. Re-index: drush search-api-index

Project information

Releases