Skip to content

Commit 1f96166

Browse files
committed
removed duplicates
1 parent 46cde75 commit 1f96166

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

roots-nextdatagov/templates/content-search-results.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,17 @@ function usasearch_display_results($query = '', $group = ''){
145145
echo '</div>';
146146
}
147147
$input = array_map("unserialize", array_unique(array_map("serialize", $results['results'])));
148-
foreach($input as $result){
148+
$usedVals = array();
149+
$outArray = array();
150+
foreach ($input as $arrayItem)
151+
{
152+
if (!in_array($arrayItem['url'],$usedVals))
153+
{
154+
$outArray[] = $arrayItem;
155+
$usedVals[] = $arrayItem['url'];
156+
}
157+
}
158+
foreach($outArray as $result){
149159
$title = $result['title'];
150160
if ($search_version=='v1'){
151161
$url = $result['unescapedUrl'];

0 commit comments

Comments
 (0)