From 8ff66b06f2cda81b365eb3876ad2a2d8f4bd4080 Mon Sep 17 00:00:00 2001 From: Mika Munterud Date: Fri, 6 Dec 2024 12:51:49 +0100 Subject: [PATCH] DIGG-450: Fixing search filter to exclude types instead of include --- .../search-page-provider-settings.ts | 14 ++------------ providers/entrystore-provider/index.tsx | 2 ++ types/entrystore-js.d.ts | 1 + utilities/entryscape/entryscape.ts | 4 +++- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/features/search/search-page/search-page-entryscape/search-page-provider-settings.ts b/features/search/search-page/search-page-entryscape/search-page-provider-settings.ts index 71181d44..588c10c4 100644 --- a/features/search/search-page/search-page-entryscape/search-page-provider-settings.ts +++ b/features/search/search-page/search-page-entryscape/search-page-provider-settings.ts @@ -34,6 +34,7 @@ interface SearchProviderConfig { language: string; takeFacets: number; sortOrder?: SearchSortOrder; + // Values to exclude from search filters?: { key: string; property: ESType; @@ -276,18 +277,7 @@ export function createSearchProviderSettings(env: EnvSettings, lang: string) { { key: "dcterms:type", property: "uri", - values: [ - "http://purl.org/adms/publishertype/Academia-ScientificOrganisation", - "http://purl.org/adms/publishertype/Company", - "http://purl.org/adms/publishertype/IndustryConsortium", - "http://purl.org/adms/publishertype/LocalAuthority", - "http://purl.org/adms/publishertype/NationalAuthority", - "http://purl.org/adms/publishertype/NonGovernmentalOrganisation", - "http://purl.org/adms/publishertype/Non-ProfitOrganisation", - "http://purl.org/adms/publishertype/RegionalAuthority", - "http://purl.org/adms/publishertype/StandardisationBody", - "http://purl.org/adms/publishertype/SupraNationalAuthority", - ], + values: ["http://purl.org/adms/publishertype/PrivateIndividual(s)"], }, ], }, diff --git a/providers/entrystore-provider/index.tsx b/providers/entrystore-provider/index.tsx index 4f33f7e3..17f3ba15 100644 --- a/providers/entrystore-provider/index.tsx +++ b/providers/entrystore-provider/index.tsx @@ -149,6 +149,8 @@ export const EntrystoreProvider: FC = ({ const es = new EntryStore( `https://${entrystoreUrl}/store` || "https://admin.dataportal.se/store", ); + // TODO: Uncomment this when cors error is fixed + // es.getREST().disableJSONP(); const esu = new EntryStoreUtil(es); esu.loadOnlyPublicEntries(true); let entry = {} as Entry; diff --git a/types/entrystore-js.d.ts b/types/entrystore-js.d.ts index c06b9d56..d36ae8d2 100644 --- a/types/entrystore-js.d.ts +++ b/types/entrystore-js.d.ts @@ -10,6 +10,7 @@ declare module "@entryscape/entrystore-js" { getEntry(_uri: string): Promise; getContextId(_uri: string): string; getContext(_uri: string): Context; + getREST(): REST; } export class EntryStoreUtil { diff --git a/utilities/entryscape/entryscape.ts b/utilities/entryscape/entryscape.ts index e4f4436e..d5f06f08 100644 --- a/utilities/entryscape/entryscape.ts +++ b/utilities/entryscape/entryscape.ts @@ -114,6 +114,8 @@ export class Entryscape { // Initialize the EntryStore instance this.entryStore = new EntryStore(this.entryscapeUrl); + // TODO: Uncomment this when cors error is fixed + // this.entryStore.getREST().disableJSONP(); this.entryStoreUtil = new EntryStoreUtil(this.entryStore); this.entryStoreUtil.loadOnlyPublicEntries(true); } @@ -414,7 +416,7 @@ export class Entryscape { if (request.filters && request.filters.length > 0) { request.filters.forEach((filter) => { if (filter.property === "uri") { - esQuery.uriProperty(filter.key, filter.values); + esQuery.uriProperty(filter.key, filter.values, "not"); } }); }