Results in view page with search api having multiple duplicate result I am in a dilly of a pickle.
I have a view that returns indexed content types.
The problem is that the view is returning multiple instances of the same content.
All of these are indexed nodes.

I read about someone else having the same problem here: 
Results in view page having multiple duplicate result
They say you can use
hook_views_pre_render() in your template.php file
to filter the extra content types out of your view.

Specifically the article said to 

function YOURTHEMENAME_views_pre_render(&amp;$view) {
  $used_nids = array();
  $new_view_result = array();

  if ($view-&gt;name == 'YOURVIEWNAME') {
    foreach ($view-&gt;result as $row) {
        if (!in_array($row-&gt;nid, $used_nids)) {
          $new_view_result[] = $row;
          $used_nids[] = $row-&gt;nid;
        }
    }

    $view-&gt;result = $new_view_result;
  }
}


This did not work for me. There was no $row->nid property. I think this is because they are using regular nodes and I am using indexed nodes.

Here is an example of my "$row printed out. (from $row above)

object(stdClass)[489]
      public 'entity' =&gt; int 4
      public '_entity_properties' =&gt; 
        array (size=2)
          'search_api_relevance' =&gt; string '1' (length=1)
          'search_api_excerpt' =&gt; string '' (length=0)


I altered this to try and filter by the property on "$row" called entity, which holds the id of the indexed item.

function BootstrapBlocks_views_pre_render(&amp;$view) {
  $used_nids = array();
  $new_view_result = array();

  if ($view-&gt;name == 'search_the_mangroves') {
    $count = 0;
    foreach ($view-&gt;result as $row) {

        if (!in_array($row-&gt;entity, $used_nids)) {

          $new_view_result[$count] = $row;

          $used_nids[$count] = $row-&gt;entity;
          $count++;
        }
    }

    $view-&gt;result = $new_view_result;
  }
}


Indeed this does filter out the extra content.  I know this because in template.php I printed it out to be sure, but when I set the view to use the new content
ie:  $view->result = $new_view_result;
I get no content type back from the view.
Any idea what might be the issue?

Please help me.

Sincerely,

David Pugh

PS: if you need any more info, let me know.
I solved my issue.
Turns out the filter TEMPLATE_views_pre_render function I programmed in was working, the problem was in the template it's self. I had tried to solve this problem on the template before trying this issue. 
Before I was trying to only allow $row 1 to return, which didn't solve my problem.
I then tried the _views_pre_render function, and saw that it was filtering but my view was not showing any data.
That is because only one row was being returned due to the _views_pre_render function, but the only row being returned was row #0, and in the template below I was specifying to only show row 1.

So, in conclusion, if you have views with search api and find that 

&lt;div class="row-fluid container-folio"&gt;

        &lt;div class="thumbnails"&gt;
        &lt;?php $lastItem = 0;?&gt;
            &lt;?php foreach ($rows as $row_number =&gt; $columns): ?&gt;    
                &lt;?php if($row_number == 1):?&gt;
                &lt;?php $array = array();?&gt;
                &lt;?php foreach ($columns as $column_number =&gt; $item): ?&gt;

                    &lt;?php if($item != null &amp;&amp; $item != "" &amp;&amp; strlen($item) != $lastItem):?&gt;
                        &lt;div class="span3"&gt;
                            &lt;div class="thumbnail2"&gt;                                                                
                                &lt;?php print $item?&gt;                                 
                            &lt;/div&gt;                  
                        &lt;/div&gt;
                        &lt;?php $lastItem = strlen($item) ?&gt;
                    &lt;?php endif ?&gt;


                &lt;?php endforeach; ?&gt;
                &lt;?php endif ?&gt;  
            &lt;?php endforeach; ?&gt;
        &lt;/div&gt;
    &lt;/div&gt;  


So, in conclusion, if you have views with search api and find that the solution listed here,
Does not work for you, then your data returned to the _views_pre_render function is probably different due to your search api, and you should follow my BootstrapBlocks_views_pre_render function above, and you should be filtering out the duplicates.