Skip to content

Commit 168b51f

Browse files
committed
fix: projects organization filter expended to institutions
1 parent c7e9fb3 commit 168b51f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

client/src/api/projects/search/index.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,17 @@ export async function searchProjects({
5353
},
5454
};
5555
const structureFilter = filters?.find((f) => f?.terms?.["participants.structure.id.keyword"])?.terms?.["participants.structure.id.keyword"];
56-
body.query.bool.filter.bool.should = [
57-
{
58-
terms: { "participants.structure.institutions.structure.keyword": structureFilter },
59-
},
60-
{
61-
terms: { "participants.structure.id.keyword": structureFilter },
62-
},
63-
];
64-
body.query.bool.filter.bool.minimum_should_match = 1;
56+
if (structureFilter) {
57+
body.query.bool.filter.bool.should = [
58+
{
59+
terms: { "participants.structure.institutions.structure.keyword": structureFilter },
60+
},
61+
{
62+
terms: { "participants.structure.id.keyword": structureFilter },
63+
},
64+
];
65+
body.query.bool.filter.bool.minimum_should_match = 1;
66+
}
6567
if (size) body.size = size;
6668
if (cursor) body.search_after = cursor;
6769
if (!query)

0 commit comments

Comments
 (0)