diff --git a/features/search/search-filters/index.tsx b/features/search/search-filters/index.tsx index f4c2f7bc..1262aca4 100644 --- a/features/search/search-filters/index.tsx +++ b/features/search/search-filters/index.tsx @@ -22,7 +22,7 @@ import { SearchFilter } from "@/features/search/search-filters/search-filter"; import { SearchContextData } from "@/providers/search-provider"; import { SettingsContext } from "@/providers/settings-provider"; import { SearchFacet, SearchFacetValue } from "@/types/search"; -import { ESRdfType, ESType } from "@/utilities/entryscape/entryscape"; +import { ESRdfType, ESType, checkBoxFilterConfigs } from "@/utilities/entryscape/entryscape"; import { SearchActiveFilters } from "./search-active-filters"; import { @@ -151,7 +151,7 @@ const FindFilters = ( ) => { if (!checkedFilters) return ""; - const allTitles = categoryFilters.map((item) => item.title); + const allTitles = categoryFilters.map((item) => item.title); const checkedTitles = checkedFilters.map((item) => item.title); const union = allTitles.filter((x) => checkedTitles.includes(x)); @@ -280,7 +280,7 @@ export const SearchFilters: FC = ({ }, [search.allFacets]); const hvd = "http://data.europa.eu/r5r/applicableLegislation"; - const national = "http://purl.org/dc/terms/subject"; + const spec = "http://purl.org/dc/terms/conformsTo"; const activeCheckboxFilters = useMemo(() => { const filters = []; @@ -300,17 +300,15 @@ export const SearchFilters: FC = ({ }); } - // National filter + // Specification filter if ( - search.request.facetValues?.some( - (t: SearchFacetValue) => t.facet === ESRdfType.national_data, - ) + search.request.facetValues?.some((t: SearchFacetValue) => t.facet === ESRdfType.spec) ) { filters.push({ - id: "national_only", - label: t(`resources|${national}`), + id: "spec_only", + label: t(`resources|${spec}`), facetValue: search.request.facetValues.find( - (t: SearchFacetValue) => t.facet === ESRdfType.national_data, + (t) => t.facet === ESRdfType.spec, ), }); } @@ -409,7 +407,7 @@ export const SearchFilters: FC = ({ ) : value?.facetValues.slice(0, show); - if (key !== hvd && key !== national) { + if (key !== hvd && key !== spec) { return (
  • = ({ /> )} - )} + )} {/* List of filter options within this category */}
      {facetValues @@ -527,28 +525,15 @@ export const SearchFilters: FC = ({ ); - } else if (key === hvd) { - return ( - filter.id === "hvd_only", - )} - onChange={() => doSearch(key, facetValues[0])} - label={t(`resources|${key}`)} - iconSize={iconSize} - /> - ); - } else if (key === national) { + } else { + const filterConfig = checkBoxFilterConfigs[key]; return ( filter.id === "national_only", + (filter) => filter.id === filterConfig.id, )} onChange={() => doSearch(key, facetValues[0])} label={t(`resources|${key}`)} diff --git a/features/search/search-filters/search-active-filters/index.tsx b/features/search/search-filters/search-active-filters/index.tsx index 9fbabe99..a8b16039 100644 --- a/features/search/search-filters/search-active-filters/index.tsx +++ b/features/search/search-filters/search-active-filters/index.tsx @@ -57,7 +57,7 @@ export function SearchActiveFilters({ (facetValue: SearchFacetValue, index: number) => facetValue.facet !== "http://data.europa.eu/r5r/applicableLegislation" && - facetValue.facet !== "http://purl.org/dc/terms/subject" && ( + facetValue.facet !== "http://purl.org/dc/terms/conformsTo" && (