From 9b2dd958b57d4d599aaa7a37714dba3da293c965 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 13 Feb 2026 04:56:39 +1300 Subject: [PATCH] fix: Use correct capability check for partial fulltext search in Users test PostgreSQL's ts_vector/ts_query doesn't support partial word matching (searching "man" won't find "manchester"), unlike MariaDB's LIKE-based search. The test used getSupportForRelationships() as a proxy for this capability, which was wrong for PostgreSQL (supports relationships but not partial fulltext search). Add supportForFulltextWildcard to console variables endpoint and use it in the Users test instead. Co-Authored-By: Claude Opus 4.6 --- .../Platform/Modules/Console/Http/Variables/Get.php | 1 + src/Appwrite/Utopia/Response/Model/ConsoleVariables.php | 9 +++++++++ tests/e2e/Scopes/Scope.php | 8 ++++++++ tests/e2e/Services/Users/UsersBase.php | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php index 6147ae61dc..c2c011af00 100644 --- a/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php +++ b/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php @@ -95,6 +95,7 @@ class Get extends Action 'supportForRelationships' => $adapter->getSupportForRelationships(), 'supportForOperators' => $adapter->getSupportForOperators(), 'supportForSpatials' => $adapter->getSupportForSpatialAttributes(), + 'supportForFulltextWildcard' => $adapter->getSupportForFulltextWildcardIndex(), 'maxIndexLength' => $adapter->getMaxIndexLength(), ]); diff --git a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php index fc6b7b6af1..d67fd96993 100644 --- a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php +++ b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php @@ -142,6 +142,15 @@ class ConsoleVariables extends Model 'example' => true, ] ) + ->addRule( + 'supportForFulltextWildcard', + [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the database adapter supports fulltext wildcard search.', + 'default' => true, + 'example' => true, + ] + ) ->addRule( 'maxIndexLength', [ diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 11b119b43e..2307e3f76f 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -95,6 +95,14 @@ abstract class Scope extends TestCase return $this->getConsoleVariables()['supportForSpatials'] ?? true; } + /** + * Check if the database adapter supports fulltext wildcard search + */ + protected function getSupportForFulltextWildcard(): bool + { + return $this->getConsoleVariables()['supportForFulltextWildcard'] ?? true; + } + /** * Get the maximum index length supported by the database adapter */ diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index 996c0fe41f..fde8ec13e9 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -707,7 +707,7 @@ trait UsersBase $this->assertCount(1, $response['body']['users']); // Some databases only support fulltext search on complete words - if ($this->getSupportForRelationships()) { + if ($this->getSupportForFulltextWildcard()) { $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'],