Skip to content

Commit fdb072a

Browse files
authored
Merge pull request #400 from topcoder-platform/hot-fix/groups-query
Hot fix/groups query
2 parents 620c11b + 98c9759 commit fdb072a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/services/ChallengeService.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,16 +414,12 @@ async function searchChallenges (currentUser, criteria) {
414414
mustNotQuery.push({ exists: { field: 'groups' } })
415415
} else if (!currentUser.isMachine && !helper.hasAdminRole(currentUser)) {
416416
// If the user is not M2M and is not an admin, return public + challenges from groups the user can access
417-
_.each(accessibleGroups, (g) => {
418-
groupsQuery.push({ match_phrase: { groups: g } })
419-
})
417+
groupsQuery.push({ terms: { groups: accessibleGroups } })
420418
// include public challenges
421419
groupsQuery.push({ bool: { must_not: { exists: { field: 'groups' } } } })
422420
}
423421
} else {
424-
_.each(groupsToFilter, (g) => {
425-
groupsQuery.push({ match_phrase: { groups: g } })
426-
})
422+
groupsQuery.push({ terms: { groups: groupsToFilter } })
427423
}
428424

429425
if (criteria.ids) {

0 commit comments

Comments
 (0)