ghoststreet / craft-smart-search
Smart Search: hybrid semantic and keyword search for Craft CMS, indexed in your own database using OpenAI embeddings.
Package info
github.com/ghoststreet/craft-smart-search
Type:craft-plugin
pkg:composer/ghoststreet/craft-smart-search
Requires
- php: >=8.2
- ext-pdo: *
- ext-pdo_pgsql: *
- craftcms/cms: ^5.0
- openai-php/client: ^0.18
- wamania/php-stemmer: 4.0
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
AI-powered Smart Search and AI Answer for Craft CMS. Smart Search blends semantic (meaning-based) and keyword ranking, and can write a short AI Answer with sources when you want one.
Requirements
- Craft CMS 5.0+
- PHP 8.2+
- MySQL, MariaDB or PostgreSQL (whichever Craft is already using)
- OpenAI API key
There is no second database to provision, no connection settings, and no SQL to run by hand. The index lives in Craft's own database, alongside your content.
Smart Search has two search engines and picks one for you from what your database can
do. The Standard engine runs everywhere. The pgvector engine runs on PostgreSQL
when the vector extension is enabled, and is faster and a little sharper at ranking.
pgvector is optional; it is a bonus if your host offers it, never a requirement. See
Search Engines.
Install
composer require ghoststreet/craft-smart-search ./craft plugin/install smart-search
Then, in Craft → Smart Search → Settings → OpenAI, paste your API key, and index your content from Smart Search → Index. That is the whole setup.
Quick example
{% set results = craft.smartSearch.search('how do I reset my password') %}
{% for r in results %}
<a href="{{ r.url }}">{{ r.title }}</a>
<p>{{ r.excerpt }}</p>
{% endfor %}
Documentation
Full documentation lives in the Smart Search Wiki:
- Getting Started
- Requirements
- Installation
- Search Engines
- Indexing Your Content
- Using Search in Templates
- Using the API (headless / external apps)
- Tuning Search Results
- AI Answer Setup
- Costs and Limits
- Security
- Troubleshooting
- Settings Reference
Support
Email dev@ghost.st for bugs or questions.
License
Licensed under the Craft License. A license is required for each Craft project running Smart Search in production.
Built by Ghost Street