diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/OrganizationController.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/OrganizationController.java index a9331c1c..82037224 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/OrganizationController.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/OrganizationController.java @@ -234,10 +234,12 @@ public class OrganizationController extends AbstractDnetController { @RequestParam(required = false, defaultValue = "false") final boolean reverse, final Authentication authentication) { + final PageRequest pageRequest = PageRequest.of(page, size, Sort.by(reverse ? Order.desc(orderBy) : Order.asc(orderBy))); + if (SPECIAL_STATUS_FOR_CANDIDATE_DUP.equals(status)) { return UserInfo.isSuperAdmin(authentication) - ? organizationSimpleViewRepository.searchCandidateDuplicates(q, PageRequest.of(page, size)) - : organizationSimpleViewRepository.searchCandidateDuplicatesForUser(q, UserInfo.getEmail(authentication), PageRequest.of(page, size)); + ? organizationSimpleViewRepository.searchCandidateDuplicates(q, pageRequest) + : organizationSimpleViewRepository.searchCandidateDuplicatesForUser(q, UserInfo.getEmail(authentication), pageRequest); } final List statuses; if (StringUtils.isNotBlank(status)) { @@ -248,8 +250,6 @@ public class OrganizationController extends AbstractDnetController { statuses = Arrays.asList(OrganizationStatus.approved.toString(), OrganizationStatus.suggested.toString()); } - final PageRequest pageRequest = PageRequest.of(page, size, Sort.by(reverse ? Order.desc(orderBy) : Order.asc(orderBy))); - return UserInfo.isSuperAdmin(authentication) ? organizationSimpleViewRepository.search(q, statuses, pageRequest) : organizationSimpleViewRepository.searchForUser(q, UserInfo.getEmail(authentication), statuses, pageRequest); diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/readonly/OrganizationSimpleViewRepository.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/readonly/OrganizationSimpleViewRepository.java index 9da4534e..9e95f100 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/readonly/OrganizationSimpleViewRepository.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/readonly/OrganizationSimpleViewRepository.java @@ -77,12 +77,12 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository searchCandidateDuplicates(@Param("text") String text, Pageable pageable); // SEARCH FOR VALID DUPLICATE CANDIDATES FOR USER @Query(value = "SELECT\n" - + " org.id,\n" - + " org.name,\n" - + " org.type,\n" - + " org.city,\n" - + " org.country,\n" - + " org.status,\n" + + " org.id AS id,\n" + + " org.name AS name,\n" + + " org.type AS type,\n" + + " org.city AS city,\n" + + " org.country AS country,\n" + + " org.status AS status,\n" + " array_remove(array_agg(DISTINCT a.acronym), NULL) AS acronyms,\n" + " array_remove(array_agg(DISTINCT u.url), NULL) AS urls,\n" + " NULL AS n_similar_dups,\n" @@ -120,8 +119,7 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository searchCandidateDuplicatesForUser(@Param("text") String text, @Param("email") String email, Pageable pageable); } diff --git a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/search/resultsByType.html b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/search/resultsByType.html index 740ec66d..ac569edf 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/search/resultsByType.html +++ b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/search/resultsByType.html @@ -1,5 +1,5 @@ diff --git a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_results_page.html b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_results_page.html index f9c7f9ec..84e331b4 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_results_page.html +++ b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_results_page.html @@ -8,7 +8,7 @@ {{searchMessage}} - Total elements:
+ Total elements:
fr {{searchMessage}}

@@ -21,29 +21,41 @@

No results

-
-