Drupal is a registered trademark of Dries Buytaert

airagsearch

No security coverage
View on drupal.org

Introduction

AI Search integrates Drupal's Search API with OpenAI (ChatGPT) to deliver intelligent, contextual answers alongside traditional search results. Instead of just showing a list of links, the module generates a concise AI-written answer grounded strictly in your site's own indexed content — no hallucinations, no off-site information. Editors get an analytics dashboard to monitor popular and zero-result queries. Whether you run a government portal, knowledge base, or content-heavy site, AI Search gives your visitors a smarter way to find answers.

Features

AI Search bridges two powerful systems — Drupal's Search API and OpenAI's language models — to give your site a question-answering layer on top of traditional keyword search.

Core capabilities include:

- Contextual AI answers generated from the top search results (default: 3 documents), with the model strictly instructed to use only your site's content as its source.
- Multi-document AI summaries at `/ai-search/summary`, drawing from up to 20 results to produce a comprehensive overview of a topic across your content.
- Search API integration with any supported backend — the database backend works out of the box for small and mid-size sites, with Solr or Elasticsearch supported for larger deployments.
- Configurable model selection — choose from GPT-4o, GPT-4 Turbo, GPT-3.5, and others; tune temperature and max token limits to match your use case.
- Markdown → HTML conversion for AI responses, rendered cleanly in the browser.
- Analytics dashboard at `/admin/reports/ai-search-analytics` tracking query frequency, zero-result rates, and usage trends — with configurable retention limits and automatic pruning.
- Granular context controls — administrators can configure how many results feed into AI responses, how much content per result, and total response length, giving full control over quality vs. cost tradeoffs.
- Clear error logging — if the API key or index is missing, the module logs a clear diagnostic and gracefully degrades without breaking the search page.

Use this module when you want your site's search to answer *questions*, not just return a list of links — ideal for documentation sites, intranets, knowledge bases, and government or institutional portals where users need direct answers from authoritative content.

Post-Installation

After enabling the module (`drush en ai_search -y` or via Extend → AI Search), follow these steps:

1. Create or select a Search API index. Go to `/admin/config/search/search-api`, create an index backed by the database (or your existing Solr/Elasticsearch server), and add at minimum the title and body fields. Index your content.
2. Configure the module. Visit `/admin/config/search/ai-search`. Enter your OpenAI API key (starts with `sk-`), select the index you created, and choose a GPT model (`gpt-4o-mini` is recommended for cost/quality balance).
3. Tune optional settings. Adjust results per page, context document count, content length per result, temperature, and max response tokens to balance answer quality against OpenAI API costs.
4. Test the search page at `/ai-search`. Enter a query and confirm both traditional results and the AI answer appear.
5. Review the analytics dashboard at `/admin/reports/ai-search-analytics` to monitor query patterns over time.

No new content types are created. The module adds one settings page, one search page, one summary page, and one analytics report. Check Reports → Recent log messages (filter by channel `ai_search`) if AI responses are not appearing.

Additional Requirements

- Drupal 10.0+ (PHP 8.1+)
- [Search API](https://www.drupal.org/project/search_api) — must be installed with at least one configured, populated index
- A Search API backend — the database backend (included with Search API) is sufficient; [Search API Solr](https://www.drupal.org/project/search_api_solr) or [Elasticsearch Connector](https://www.drupal.org/project/elasticsearch_connector) are supported for larger sites
- An OpenAI account and API key — generated at [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
- Guzzle HTTP client — included with Drupal core

- [Search API Solr](https://www.drupal.org/project/search_api_solr) — for high-volume or advanced relevance-tuned deployments
- [Search API Autocomplete](https://www.drupal.org/project/search_api_autocomplete) — adds query suggestions to complement AI answers
- A response caching layer (custom implementation recommended) — AI responses for identical queries can be cached in Drupal's key-value store to reduce OpenAI API costs

Similar projects

- [Search API](https://www.drupal.org/project/search_api) — the foundation this module builds on; provides powerful keyword search but no AI answer generation.
- [AI](https://www.drupal.org/project/ai) (Drupal AI initiative module) — a broader framework for integrating multiple AI providers across many Drupal features. AI Search is a focused, self-contained alternative specifically scoped to search-and-answer workflows, with its own analytics and configuration UI — no additional AI framework required.
- [OpenAI / ChatGPT / AI Search Integration](https://www.drupal.org/project/openai) — a general-purpose OpenAI integration module. AI Search differs by being search-first: it is purpose-built around the Search API retrieval pipeline (RAG pattern) with built-in analytics, context tuning, and a dedicated search UI.

Supporting this Module

Development and maintenance of this module is led by [Frank Feruch](https://www.frankferuch.com), Full Stack Developer, Platform Architect and enterprise AI specialist. If this module saves you time or adds value to your project, consider reaching out .

Community Documentation

- Full HTML Manual — bundled with the module at `help.html`; accessible from the Drupal help system at `/admin/help/ai_search` after installation.
- Module Settings — `/admin/config/search/ai-search`
- Search Page — `/ai-search`
- Analytics Dashboard — `/admin/reports/ai-search-analytics`
- Summary Page — `/ai-search/summary` (available after performing a search)

Activity

Total releases
1
First release
Mar 2026
Latest release
4 hours ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.0-alpha2 Pre-release Mar 7, 2026