Skip to content

Commit

Permalink
DIGG-450: Fixing search filter to exclude types instead of include
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaMunterud committed Dec 6, 2024
1 parent f97f2dd commit 8ff66b0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface SearchProviderConfig {
language: string;
takeFacets: number;
sortOrder?: SearchSortOrder;
// Values to exclude from search
filters?: {
key: string;
property: ESType;
Expand Down Expand Up @@ -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)"],
},
],
},
Expand Down
2 changes: 2 additions & 0 deletions providers/entrystore-provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export const EntrystoreProvider: FC<EntrystoreProviderProps> = ({
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;
Expand Down
1 change: 1 addition & 0 deletions types/entrystore-js.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare module "@entryscape/entrystore-js" {
getEntry(_uri: string): Promise<Entry>;
getContextId(_uri: string): string;
getContext(_uri: string): Context;
getREST(): REST;
}

export class EntryStoreUtil {
Expand Down
4 changes: 3 additions & 1 deletion utilities/entryscape/entryscape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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");
}
});
}
Expand Down

0 comments on commit 8ff66b0

Please sign in to comment.