You are here

function apachesolr_search_search_page_custom in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr_search.module \apachesolr_search_search_page_custom()
  2. 7 apachesolr_search.module \apachesolr_search_search_page_custom()

Mimics apachesolr_search_search_page() but is used for custom search pages We prefer to keep them seperate so we are not dependent from core search when someone tries to disable the core search

Parameters

$results: The results that came from apache solr

$build: the build array from where this function was called. Good to append output to the build array

$search_page: the search page that is requesting an output

2 calls to apachesolr_search_search_page_custom()
apachesolr_search_custom_page in ./apachesolr_search.pages.inc
Returns search results on user defined search pages.
apachesolr_search_search_page in ./apachesolr_search.module
The default search page

File

./apachesolr_search.module, line 921
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_search_page_custom($results, $search_page, $build = array()) {
  if (!empty($search_page['settings']['apachesolr_search_spellcheck'])) {

    // Retrieve suggestion
    $suggestions = apachesolr_search_get_search_suggestions($search_page['env_id']);
    if ($search_page && !empty($suggestions)) {
      $build['suggestions'] = theme('apachesolr_search_suggestions', array(
        l($suggestions[0], $search_page['search_path'] . '/' . $suggestions[0]),
      ));
    }
  }

  // Retrieve expected results from searching
  if (!empty($results['apachesolr_search_browse'])) {

    // Show facet browsing blocks.
    $build['search_results'] = apachesolr_search_page_browse($results['apachesolr_search_browse'], $search_page['env_id']);
  }
  elseif ($results) {
    $build['search_results'] = theme('search_results', $results, 'apachesolr_search', $search_page);
  }
  else {

    // Give the user some custom help text.
    $build['search_results'] = theme('apachesolr_search_noresults');
  }

  // Allows modules to alter the render array before returning.
  drupal_alter('apachesolr_search_page', $build, $search_page);
  return $build;
}