MariaDB VDB Provider - Installation Instructions
================================================

REQUIREMENTS
------------
- Drupal 10.2+ or Drupal 11+
- MariaDB 11.7+ (11.8 LTS recommended)
- PHP 8.1+
- PHP mysqli extension enabled
- Drupal AI module

INSTALLATION
------------
1. Verify MariaDB Version
   Run in your MariaDB database:
   SELECT VERSION();
   
   Should return 11.7 or higher for vector support.

2. Install the Module
   composer require drupal/ai_vdb_provider_mariadb
   drush en ai_vdb_provider_mariadb -y

3. Done!
   The module automatically uses your Drupal database.
   No additional configuration is needed.

OPTIONAL: EXTERNAL DATABASE
----------------------------
To use a separate MariaDB instance for vectors, add to settings.php:

$config['ai_vdb_provider_mariadb.settings'] = [
  'host' => 'localhost',
  'port' => 3306,
  'username' => 'vector_user',
  'password' => 'secure_password',
  'database' => 'drupal_vectors',
];

WARNING: External databases do NOT support Drupal transactions.
If an entity save fails, vectors will not be automatically rolled back.

USAGE
-----
1. Create a Search API server with AI Search backend
2. Select "MariaDB vector DB" as the VDB provider
3. Configure your embedding strategy
4. Create an index and add fields
5. Index your content

VERIFYING VECTOR SUPPORT
-------------------------
Run this SQL to verify vector support is available:

CREATE TABLE test_vectors (
    id INT AUTO_INCREMENT PRIMARY KEY,
    embedding VECTOR(3) NOT NULL,
    VECTOR INDEX (embedding) DISTANCE=cosine
) ENGINE=InnoDB;

If this succeeds, vector support is working!

Drop the test table:
DROP TABLE test_vectors;

TROUBLESHOOTING
---------------
- If vectors don't work, verify MariaDB version is 11.7+
- Check PHP mysqli extension: php -m | grep mysqli
- Review logs: drush watchdog:show --type=ai_vdb_provider_mariadb
- For Lando: Ensure database service is mariadb:11.8+

For more information, see README.md
