Skip to content

Commit 9a6ce72

Browse files
authored
fix: Search Indexing on User Model (#2213)
* style: Add helpful comments * feat: Add search index getter for User model
1 parent c3b1d9c commit 9a6ce72

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

backend/app/Models/User.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ public function toSearchableArray()
149149
];
150150
}
151151

152+
/**
153+
* Get the name of the index associated with the model.
154+
*
155+
* @return string
156+
*/
157+
public function searchableAs(): string
158+
{
159+
return 'users_index';
160+
}
161+
152162
/**
153163
* Submissions that belong to the user
154164
*

backend/tests/Api/UserQueryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static function searchUserTermsProvider(): array
129129
[
130130
'searchTerm' => null,
131131
'shouldFind' => null,
132-
'count' => 10,
132+
'count' => 10, // Search returns 10 results by default
133133
],
134134
[
135135
'searchTerm' => '12345',
@@ -144,7 +144,7 @@ public static function searchUserTermsProvider(): array
144144
[
145145
'searchTerm' => '',
146146
'shouldFind' => null,
147-
'count' => 10,
147+
'count' => 10, // Search returns 10 results by default
148148
],
149149
];
150150
}

0 commit comments

Comments
 (0)