Skip to content

Commit 2aadc20

Browse files
updated database index validator
1 parent 838068b commit 2aadc20

1 file changed

Lines changed: 0 additions & 46 deletions

File tree

src/Database/Database.php

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,52 +3635,6 @@ public function createIndex(string $collection, string $id, string $type, array
36353635
throw new LimitException('Index limit reached. Cannot create new index.');
36363636
}
36373637

3638-
switch ($type) {
3639-
case self::INDEX_KEY:
3640-
if (!$this->adapter->getSupportForIndex()) {
3641-
throw new DatabaseException('Key index is not supported');
3642-
}
3643-
break;
3644-
3645-
case self::INDEX_UNIQUE:
3646-
if (!$this->adapter->getSupportForUniqueIndex()) {
3647-
throw new DatabaseException('Unique index is not supported');
3648-
}
3649-
break;
3650-
3651-
case self::INDEX_FULLTEXT:
3652-
if (!$this->adapter->getSupportForFulltextIndex()) {
3653-
throw new DatabaseException('Fulltext index is not supported');
3654-
}
3655-
break;
3656-
3657-
case self::INDEX_SPATIAL:
3658-
if (!$this->adapter->getSupportForSpatialAttributes()) {
3659-
throw new DatabaseException('Spatial indexes are not supported');
3660-
}
3661-
if (!empty($orders) && !$this->adapter->getSupportForSpatialIndexOrder()) {
3662-
throw new DatabaseException('Spatial indexes with explicit orders are not supported. Remove the orders to create this index.');
3663-
}
3664-
break;
3665-
3666-
case Database::INDEX_HNSW_EUCLIDEAN:
3667-
case Database::INDEX_HNSW_COSINE:
3668-
case Database::INDEX_HNSW_DOT:
3669-
if (!$this->adapter->getSupportForVectors()) {
3670-
throw new DatabaseException('Vector indexes are not supported');
3671-
}
3672-
break;
3673-
3674-
case self::INDEX_OBJECT:
3675-
if (!$this->adapter->getSupportForObjectIndexes()) {
3676-
throw new DatabaseException('Object indexes are not supported');
3677-
}
3678-
break;
3679-
3680-
default:
3681-
throw new DatabaseException('Unknown index type: ' . $type . '. Must be one of ' . Database::INDEX_KEY . ', ' . Database::INDEX_UNIQUE . ', ' . Database::INDEX_FULLTEXT . ', ' . Database::INDEX_SPATIAL . ', ' . Database::INDEX_OBJECT . ', ' . Database::INDEX_HNSW_EUCLIDEAN . ', ' . Database::INDEX_HNSW_COSINE . ', ' . Database::INDEX_HNSW_DOT);
3682-
}
3683-
36843638
/** @var array<Document> $collectionAttributes */
36853639
$collectionAttributes = $collection->getAttribute('attributes', []);
36863640
$indexAttributesWithTypes = [];

0 commit comments

Comments
 (0)