I have business requirements to do a total overhaul of the Search Results page for our site. Based on the searching i've done so far, I have a few options to adjust the results pulled by the search:
- hook_search_page() to alter individual results within a module
- Overriding the search results templates (search-result.tpl.php, search-results.tpl.php)
- I'm sure there are template.php files
Here are the challenges i'm running into:
- I have a custom module (example_search.module) with a hook_search_page() call that does not adjust the actual display of results. It insists on showing the OLs with an "apachesolr_search-results" class, which means any changes i'm making are being ignored. Am I missing anything here?
- the tpl.php files, on the other hand work as expected. No big deal there. But I need to adjust how results are rendered.
- I also need to adjust the layout of the search results using Context and Delta. I've applied rules using the "Apache Solr" conditions in Context for a custom delta with nothing sticking. Not sure why that's happening.
So in essence, what's the optimal way to adjust results returned by hook_search_page() within Apache Solr?
The code from my search module is below:
<?php
/**
* Implements hook_search_page()
*/
function example_search_page($results) {
dpm($results, "Results");
$output['prefix']['#markup'] = '<ol class="search-results testclass">';
foreach ($results as $entry) {
$output[] = array(
'#theme' => 'search_result',
'#result' => $entry,
'#module' => 'mwb_search',
);
}
$output['suffix']['#markup'] = '</ol>' . theme('pager');
return $output;
}