mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
b952bf7978
commit
9b2dd958b5
4 files changed
+19
-1
No files matched your search
@@ -95,6 +95,7 @@ class Get extends Action
|
||||
'supportForRelationships' => $adapter->getSupportForRelationships(),
|
||||
'supportForOperators' => $adapter->getSupportForOperators(),
|
||||
'supportForSpatials' => $adapter->getSupportForSpatialAttributes(),
|
||||
'supportForFulltextWildcard' => $adapter->getSupportForFulltextWildcardIndex(),
|
||||
'maxIndexLength' => $adapter->getMaxIndexLength(),
|
||||
]);
|
||||
|
||||
|
||||
@@ -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',
|
||||
[
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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'],
|
||||
|
||||
Reference in new issue
Block a user