Group search result of drupal 7 and show them in tabs I am using function like this. I have grouped the search output and displaying, but i need to make these grouping in tabs using any tabs feature available, how do i do it over here by using any other module function.

function arras_preprocess_search_results(&amp;$variables) {
    $variables['search_results'] = '';
    // get a list of node types
    $nodeTypes = node_type_get_types();
    // loop through results, group by type
    $resultTypes = array();
    foreach ($variables['results'] as $result) {
        $resultTypes[$result['node']-&gt;type][] = $result;  
    }

    // create fieldsets for each type
    foreach ($resultTypes as $resultType =&gt; $resultTypeResults) {
        $value = "";
        // loop through entries
        foreach ($resultTypeResults as $result) {
            $value .= theme('search_result', array('result' =&gt; $result, 'module' =&gt; $variables['module']));
        }
        //$variables['search_results'] .= $value;
        // add fieldset

    /*    $variables['search_results'] .= theme('fieldset',
            array(
                'element' =&gt; array(
                    '#title' =&gt; $nodeTypes[$resultType]-&gt;name,
                    '#collapsible' =&gt; TRUE,
                    '#collapsed' =&gt; TRUE,
                    '#value' =&gt; $value
                )
            )
        );
      */  




/* Problem here */



     $variables['search_results'] .=   quicktabs_build_quicktabs('test',array(),array('title' =&gt; $nodeTypes[$resultType]-&gt;name, 'contents' =&gt; 'test')); 
    }
}
Thank you for sharing. I made some minor changes in your code because I was getting some floating search results. So I changed this part:

    $output .=  '&lt;div id="tabs-'.$i.'"&gt;';
    $output .=  $value;
    $output .=  '&lt;/div&gt;';

}
    $output .= '&lt;/ul&gt;';
    $output .= '&lt;/div&gt;';

     $variables['search_results'] = $output;


To this:

$output_results .=  '&lt;div id="tabs-'.$i.'"&gt;';
$output_results .=  $value;
$output_results .=  '&lt;/div&gt;';

}
$output .= '&lt;/ul&gt;';
$output .= $output_results;
$output .= '&lt;/div&gt;';

 $variables['search_results'] = $output;