Skip to main content
1 of 2

Customizing the search results page with Apache Solr

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:

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.

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;
}