fix #600: only get distcinct results in search

This commit is contained in:
2019-12-18 17:58:40 +01:00
parent f19d9445a8
commit eb19a2f6b3
@@ -365,6 +365,7 @@ class EdlpSearchController extends ControllerBase {
// dpm($items); // dpm($items);
$this->items = []; $this->items = [];
$ids = [];
foreach ($items as $item) { foreach ($items as $item) {
try { try {
/** @var \Drupal\Core\Entity\EntityInterface $entity */ /** @var \Drupal\Core\Entity\EntityInterface $entity */
@@ -376,7 +377,12 @@ class EdlpSearchController extends ControllerBase {
if (!$entity) { if (!$entity) {
continue; continue;
} }
// get distinct results
if(in_array($entity->id(), $ids)){
continue;
}
$ids[] = $entity->id();
// record results
$this->items[] = $entity; $this->items[] = $entity;
} }
// dpm($this->items); // dpm($this->items);