Skip to content

Commit

Permalink
Merge pull request #1635 from danskernesdigitalebibliotek/DDFBRA-211-…
Browse files Browse the repository at this point in the history
…update-graphql-schema

Update graphql schema
  • Loading branch information
JacobArrow authored Jan 13, 2025
2 parents 38737ff + b0adf94 commit c5bd665
Show file tree
Hide file tree
Showing 7 changed files with 579 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/apps/search-result/useFilterHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ const useFilterHandler = () => {
const urlFilter = getUrlQueryParam(mapFacetToFilter(facet));
if (urlFilter) {
// We only use term from the url, therefore key is not important here.
// We dont have a traceId, so we just use a placeholder.
addToFilter({
facet: mapFacetToFilter(facet),
term: { key: "key", term: urlFilter }
term: { key: "key", term: urlFilter, traceId: "traceId" }
});
}
};
Expand Down
17 changes: 17 additions & 0 deletions src/components/facet-browser/__snapshots__/helper.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,43 @@ exports[`createFacetsMap 1`] = `
"key": "dan",
"score": 427,
"term": "Dansk",
"traceId": "2",
},
"mainLanguages:eng": {
"key": "eng",
"score": 82,
"term": "Engelsk",
"traceId": "3",
},
"materialTypesGeneral:artikler": {
"key": "artikler",
"score": 346,
"term": "artikler",
"traceId": "4",
},
"materialTypesGeneral:bøger": {
"key": "bøger",
"score": 74,
"term": "bøger",
"traceId": "5",
},
"materialTypesGeneral:computerspil": {
"key": "computerspil",
"score": 26,
"term": "computerspil",
"traceId": "7",
},
"materialTypesGeneral:e-bøger": {
"key": "e-bøger",
"score": 38,
"term": "e-bøger",
"traceId": "6",
},
"materialTypesGeneral:film": {
"key": "film",
"score": 9,
"term": "film",
"traceId": "8",
},
}
`;
Expand Down Expand Up @@ -77,6 +84,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -87,6 +95,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -97,6 +106,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -107,6 +117,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -117,6 +128,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -127,6 +139,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -137,6 +150,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -147,6 +161,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -157,6 +172,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -167,6 +183,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand Down
1 change: 1 addition & 0 deletions src/components/facet-browser/facet-search.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ query searchFacet(
key
term
score
traceId
}
}
}
Expand Down
36 changes: 24 additions & 12 deletions src/components/facet-browser/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const getPlaceHolderFacets = (facets: string[]) =>
values: [
{
key: "",
term: ""
term: "",
traceId: ""
}
]
}));
Expand Down Expand Up @@ -182,19 +183,22 @@ if (import.meta.vitest) {
Dansk: {
key: "dan",
term: "Dansk",
score: 295
score: 295,
traceId: "1"
},
Engelsk: {
key: "eng",
term: "Engelsk",
score: 9
score: 9,
traceId: "2"
}
},
accessTypes: {
Fysisk: {
key: "PHYSICAL",
term: "Fysisk",
score: 356
score: 356,
traceId: "3"
}
}
};
Expand All @@ -207,7 +211,8 @@ if (import.meta.vitest) {
{
key: "computerspil",
term: "computerspil",
score: 26
score: 26,
traceId: "1"
}
]
},
Expand All @@ -218,12 +223,14 @@ if (import.meta.vitest) {
{
key: "dan",
term: "Dansk",
score: 427
score: 427,
traceId: "2"
},
{
key: "eng",
term: "Engelsk",
score: 82
score: 82,
traceId: "3"
}
]
},
Expand All @@ -234,27 +241,32 @@ if (import.meta.vitest) {
{
key: "artikler",
term: "artikler",
score: 346
score: 346,
traceId: "4"
},
{
key: "bøger",
term: "bøger",
score: 74
score: 74,
traceId: "5"
},
{
key: "e-bøger",
term: "e-bøger",
score: 38
score: 38,
traceId: "6"
},
{
key: "computerspil",
term: "computerspil",
score: 26
score: 26,
traceId: "7"
},
{
key: "film",
term: "film",
score: 9
score: 9,
traceId: "8"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ query intelligentFacets(
key
term
score
traceId
}
}
}
Expand Down
Loading

0 comments on commit c5bd665

Please sign in to comment.