Skip to content

Commit

Permalink
feat: make use of policy_marker_combined filter
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanoshadjipetrou committed Jan 25, 2022
1 parent f6f4f08 commit f78cf85
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions server/utils/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 " : ""
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit f78cf85

Please sign in to comment.