PostgreSQL pgvector provider for the Backdrop CMS AI Search module. Stores and queries embeddings directly in your existing PostgreSQL database using the pgvector extension, eliminating the need for a separate vector database service.
- Backdrop CMS 1.x
- PHP 8.2 or later
ai_searchmodule- PostgreSQL with the pgvector extension installed
- The pgvector extension must be enabled in your database:
CREATE EXTENSION IF NOT EXISTS vector; - The PHP
pdo_pgsqlextension
- Install this module using the official Backdrop CMS instructions.
- Enable this module.
- Go to Admin -> Configuration -> Search and Metadata -> Search API and create or edit a server.
- Select PGVector as the service backend.
- Configure the server settings:
- Host, Port (default
5432), Database, Username, Password — connection to the PostgreSQL server that has pgvector enabled. Host and database are required. - Connection timeout — seconds to wait for the connection (default
5). - SSL mode — optional PostgreSQL
sslmode. - Schema — PostgreSQL schema to store vector tables in. Defaults to
public. - Table name — Optional. Leave empty to auto-generate a per-index table name prefixed with
search_vector_. A custom table name must be unique per Search API index. - Metric Type — Distance metric for nearest-neighbor search:
COSINE(default),L2, orIP. - IVFFLAT lists — Number of inverted lists for the IVFFlat index. Defaults to
100. RunANALYZEon the table after indexing for this setting to take effect. - Embeddings engine — Select the embedding model to use for generating vectors.
- Host, Port (default
- Create a Search API index on that server.
- Index your content to populate the vector table.
- This backend opens its own connection to a dedicated PostgreSQL server, so the site database can stay on MySQL or MariaDB.
- The vector table and IVFFlat index are created automatically on first index run.
- The embedding dimension is derived from the selected embeddings engine configuration.
Bugs and feature requests should be reported in the Issue Queue.
- Created for Backdrop CMS by Justin Keiser.
- Developed with AI assistance.
This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.