From 56e83d5b6c58accf62897011705d1261a5778375 Mon Sep 17 00:00:00 2001 From: Abdi Mo Date: Mon, 18 May 2026 11:01:01 +0200 Subject: [PATCH] fixed jobs fullfacet access with text --- src/jobs/jobs.service.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/jobs/jobs.service.ts b/src/jobs/jobs.service.ts index 126e19245..317c884c6 100644 --- a/src/jobs/jobs.service.ts +++ b/src/jobs/jobs.service.ts @@ -195,9 +195,16 @@ export class JobsService { JobDocument, IJobFields >(this.jobModel, "id", fields, facets); - pipeline.unshift({ - $match: access, - }); + + const firstStage = pipeline[0] as { $match: Record }; + + if (fields["text"]) { + pipeline.splice(0, 1, { $match: { $and: [access, firstStage.$match] } }); + } else { + pipeline.unshift({ + $match: access, + }); + } return await this.jobModel.aggregate(pipeline).exec(); }