Skip to content

Commit

Permalink
Fix collection check on OAI output
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Aug 7, 2023
1 parent 2005043 commit 3b4beec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/handlers/oai/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ async function oaiSearch(dates, set, size = 250) {
{ term: { visibility: "Public" } },
range,
],
...(set && { must: [{ term: { "collection.id": set } }] }),
},
};
if (set) query.bool.must.push({ term: { "collection.id": set } });

const body = {
size,
query,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/oai/verbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function header(work) {
datestamp: work.modified_date,
};

if (Object.keys(work.collection).length > 0) {
if (work?.collection && Object.keys(work.collection).length > 0) {
fields = {
...fields,
setSpec: work.collection.id,
Expand Down

0 comments on commit 3b4beec

Please sign in to comment.