From f78cf85dc2429690ff4b57c51ccd72284c10bcbe Mon Sep 17 00:00:00 2001 From: Stefanos Date: Tue, 25 Jan 2022 12:27:23 +0200 Subject: [PATCH] feat: make use of policy_marker_combined filter --- server/utils/filters.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/server/utils/filters.ts b/server/utils/filters.ts index ca0f38c..2cfffd7 100644 --- a/server/utils/filters.ts +++ b/server/utils/filters.ts @@ -81,11 +81,9 @@ export function getFormattedFilters( // .join(" ")})${addTrailingAND ? " AND " : ""}`; // } else if (filterKey === "policy_marker_code") { - result += `${filterKey}:(${filters[filterKey].join( - " " - )}) AND policy_marker_significance:(1 2 3 4)${ - addTrailingAND ? " AND " : "" - }`; + result += `policy_marker_combined:(${filters[filterKey] + .map((code: string) => `${code}__1 ${code}__2 ${code}__3 ${code}__4`) + .join(" ")})${addTrailingAND ? " AND " : ""}`; } else if (filterKey !== "year_period") { result += `${filterKey}:(${filters[filterKey].join(" ")})${ addTrailingAND ? " AND " : "" @@ -173,11 +171,9 @@ export function getQuery(filters: any, search: string, searchFields: string[]) { filters[filterKey][0].endDate }]${addTrailingAND ? " AND " : ""}`; } else if (filterKey === "policy_marker_code") { - query += `${filterKey}:(${filters[filterKey].join( - " " - )}) AND policy_marker_significance:(1 2 3 4)${ - addTrailingAND ? " AND " : "" - }`; + query += `policy_marker_combined:(${filters[filterKey] + .map((code: string) => `${code}__1 ${code}__2 ${code}__3 ${code}__4`) + .join(" ")})${addTrailingAND ? " AND " : ""}`; } else if (filterKey === "year_period") { query += `transaction_value_date:[${ filters[filterKey]