Source:
<code>public Page<CommunityRest> getSubcommunities(@Nullable HttpServletRequest request, UUID communityId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Community community = communityService.find(context, communityId); if (community == null) { throw new ResourceNotFoundException("No such community: " + communityId); } Pageable pageable = utils.getPageable(optionalPageable); List<Community> publicSubcommunities = new LinkedList<Community>(); IndexObjectFactoryFactory indexObjectFactory = IndexObjectFactoryFactory.getInstance(); IndexableObject scopeObject = indexObjectFactory.getIndexableObjects(context, community).get(0); <START> DiscoverQuery discoverQuery = new DiscoverQuery(); <END> discoverQuery.setQuery("*:*"); discoverQuery.setDSpaceObjectFilter(IndexableCommunity.TYPE); discoverQuery.setStart(Math.toIntExact(pageable.getOffset())); discoverQuery.setMaxResults(pageable.getPageSize()); DiscoverResult resp = searchService.search(context, scopeObject, discoverQuery); long tot = resp.getTotalSearchResults(); for (IndexableObject solrCommunities : resp.getIndexableObjects()) { Community c = ((IndexableCommunity) solrCommunities).getIndexedObject(); publicSubcommunities.add(c); } return converter.toRestPage(publicSubcommunities, pageable, tot, utils.obtainProjection()); } catch (SQLException | SearchServiceException e) { throw new RuntimeException(e.getMessage(), e); } }</code><technical_language>@abollini : I suspect subCommunities search added simply this location.parent filter exist (so early attempt a subcommunities endpoint). However, I agree that, assuming feel location.parent filter is direction, **remove** subCommunities search endpoint /api/core/communities/[uuid]/subcommunities replacement. in mind this change require minor modifications Angular UI, if is subCommunities search endpoint</technical_language>

Target:
public Page<CommunityRest> getSubcommunities(@Nullable HttpServletRequest request, UUID communityId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Community community = communityService.find(context, communityId); if (community == null) { throw new ResourceNotFoundException("No such community: " + communityId); } Pageable pageable = utils.getPageable(optionalPageable); List<Community> publicSubcommunities = new LinkedList<Community>(); IndexObjectFactoryFactory indexObjectFactory = IndexObjectFactoryFactory.getInstance(); IndexableObject scopeObject = indexObjectFactory.getIndexableObjects(context, community).get(0); DiscoverQuery discoverQuery = new DiscoverQuery(); discoverQuery.setQuery("*:*"); discoverQuery.setDSpaceObjectFilter(IndexableCommunity.TYPE); discoverQuery.addFilterQueries("location.parent:" + communityId); discoverQuery.setStart(Math.toIntExact(pageable.getOffset())); discoverQuery.setMaxResults(pageable.getPageSize()); DiscoverResult resp = searchService.search(context, scopeObject, discoverQuery); long tot = resp.getTotalSearchResults(); for (IndexableObject solrCommunities : resp.getIndexableObjects()) { Community c = ((IndexableCommunity) solrCommunities).getIndexedObject(); publicSubcommunities.add(c); } return converter.toRestPage(publicSubcommunities, pageable, tot, utils.obtainProjection()); } catch (SQLException | SearchServiceException e) { throw new RuntimeException(e.getMessage(), e); } }