From 0321c88e406be912efff9dd3c5c3f71f2cee137e Mon Sep 17 00:00:00 2001 From: Steffen Aas Date: Fri, 22 Nov 2024 10:07:46 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Filtrering=20p=C3=A5=20yrkeskategori=20fung?= =?UTF-8?q?erer=20ikke?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Endre allMusts til Array av filter Arrays - legg til must array isteden for spread --- src/app/(sok)/_utils/elasticSearchRequestBody.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/(sok)/_utils/elasticSearchRequestBody.ts b/src/app/(sok)/_utils/elasticSearchRequestBody.ts index 732cc272e..0dacf8d78 100644 --- a/src/app/(sok)/_utils/elasticSearchRequestBody.ts +++ b/src/app/(sok)/_utils/elasticSearchRequestBody.ts @@ -499,7 +499,7 @@ function filterNestedFacets( childKey: string, nestedField?: string, ) { - let allMusts: (TermFilter | BoolFilter)[] = []; + let allMusts: Array> = []; if (parents && parents.length > 0) { parents.forEach((parent) => { let must: (TermFilter | BoolFilter)[] = [ @@ -526,7 +526,7 @@ function filterNestedFacets( ]; } - allMusts = [...allMusts, ...must]; + allMusts = [...allMusts, must]; }); } @@ -648,7 +648,10 @@ function filterLocation( } const internationalObject: BoolFilter = { - bool: {}, + bool: { + must_not: [], + should: [], + }, }; if (international) { From 8e3ea62ae3ad672b8e5f15bee6b92737b7c52aab Mon Sep 17 00:00:00 2001 From: Steffen Aas Date: Fri, 22 Nov 2024 10:10:52 +0100 Subject: [PATCH 2/2] Fjern utilsiktet feil med internationalObject --- src/app/(sok)/_utils/elasticSearchRequestBody.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/app/(sok)/_utils/elasticSearchRequestBody.ts b/src/app/(sok)/_utils/elasticSearchRequestBody.ts index 0dacf8d78..774670cf6 100644 --- a/src/app/(sok)/_utils/elasticSearchRequestBody.ts +++ b/src/app/(sok)/_utils/elasticSearchRequestBody.ts @@ -648,10 +648,7 @@ function filterLocation( } const internationalObject: BoolFilter = { - bool: { - must_not: [], - should: [], - }, + bool: {}, }; if (international) {