From eb19a2f6b3305aa61253d58ba41048117604df0a Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Wed, 18 Dec 2019 17:58:40 +0100 Subject: [PATCH] fix #600: only get distcinct results in search --- .../edlp_search/src/Controller/EdlpSearchController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php b/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php index 23ae899ce..9aa69ec39 100644 --- a/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php +++ b/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php @@ -365,6 +365,7 @@ class EdlpSearchController extends ControllerBase { // dpm($items); $this->items = []; + $ids = []; foreach ($items as $item) { try { /** @var \Drupal\Core\Entity\EntityInterface $entity */ @@ -376,7 +377,12 @@ class EdlpSearchController extends ControllerBase { if (!$entity) { continue; } - + // get distinct results + if(in_array($entity->id(), $ids)){ + continue; + } + $ids[] = $entity->id(); + // record results $this->items[] = $entity; } // dpm($this->items);