Ibexa DXP Discussions

Community discussion forum for developers working with Ibexa DXP

Removing duplicates

Duplicates; we get duplicate results at http://eye-on-sports.org/ even though location_id on tree_root is set to 56 (“Forsiden”). The articles (as an example) are also posted in “Blogger/Jonas A.”. “Forsiden” is the front page, and all articles that reside there is located in some other location too. Main location for the articles are allways something other than “Forsiden”. There i so other content there now than the three articles, but the result are the same if I put content in some other sub-folder, duplicates

So how do I get rid of the duplicates?

The reason for having the content object at two places at the same time is that “Forsiden” (the frontpage) is edited ad content prioritized, but in the content objects main location it is sorted on publication date.

An whenever the content is out of date it is just removed from the front page living on in it’s main location.

$contents = [];
$results = $this->searchService->findContents($query);
foreach ($result->searchHits as $hit) {
   $content = $hit->valueObject;
   $contents[content->id] = content;
dump($contents); // No duplicates (but last found = last keept)

Hi Steve and thanks for the snipplet. However, I am a rookie, and I do not understand what wrapper to put on the snipplet…

Regads, Atle