Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Store/Bridge/MariaDB/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ public function query(Vector $vector, array $options = [], ?float $minScore = nu
}

/**
* @param array{} $options
* @param array{dimensions?: positive-int} $options
*/
public function initialize(array $options = []): void
{
if ([] !== $options) {
throw new InvalidArgumentException('No supported options');
if ([] !== $options && !\array_key_exists('dimensions', $options)) {
throw new InvalidArgumentException('The only supported option is "dimensions"');
}

$serverVersion = $this->connection->getAttribute(\PDO::ATTR_SERVER_VERSION);
Expand All @@ -146,13 +146,14 @@ public function initialize(array $options = []): void
CREATE TABLE IF NOT EXISTS %1$s (
id BINARY(16) NOT NULL PRIMARY KEY,
metadata JSON,
%2$s VECTOR(1536) NOT NULL,
%2$s VECTOR(%4$d) NOT NULL,
VECTOR INDEX %3$s (%2$s)
)
SQL,
$this->tableName,
$this->vectorFieldName,
$this->indexName,
$options['dimensions'] ?? 1536,
),
);
}
Expand Down