Align quick search with current financial directory while retaining historical records
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-13 21:14:25 +02:00
parent 1d52c3d8f4
commit 2f1ef2fdfc
2 changed files with 3 additions and 2 deletions
@@ -56,7 +56,7 @@ class GlobalSearchController extends Controller
if (! $service->installed()) {
return ['count' => 0, 'fetch' => fn ($offset, $limit) => []];
}
$query = $service->publicQuery()->select('p.id', 'v.payload')->selectRaw("v.payload->>'title' AS title");
$query = $service->catalogueQuery([])->select('p.id', 'v.payload')->selectRaw("v.payload->>'title' AS title");
foreach ($tokens as $token) {
$query->where(function ($match) use ($search, $token) {
$search->orFields($match, ["(v.payload->>'title')",
+2 -1
View File
@@ -56,11 +56,12 @@ final class GlobalSearchCountTest extends TestCase
}
$actor = User::factory()->create();
$marker = 'SYNTHFIN'.Str::random(8);
foreach (['published', 'draft', 'future'] as $state) {
foreach (['published', 'draft', 'future', 'historical', 'merged'] as $state) {
$id = (string) Str::uuid();
$version = (string) Str::uuid();
$payload = json_encode(['title' => $marker.' '.$state, 'kind' => 'institution', 'summary' => 'Nota de preparação: ficha e documento gerador.',
'institution_nature' => 'bank', 'institution_services' => ['investment'],
'institution_status' => in_array($state, ['historical', 'merged'], true) ? $state : 'reported',
'locations' => [['location_text' => 'Nampula']], 'products' => [['title' => 'Crédito PME', 'coverage' => 'national', 'needs' => ['investment']]]], JSON_THROW_ON_ERROR);
DB::table('funding_programmes')->insert(['id' => $id, 'code' => $marker.$state, 'draft' => $payload, 'created_by' => $actor->id]);
DB::table('funding_programme_versions')->insert(['id' => $version, 'programme_id' => $id, 'version' => 1, 'payload' => $payload,