You are here

function ds_search_conditions in Display Suite 7

Implementation of a search_view() conditions callback.

1 string reference to 'ds_search_conditions'
ds_search_search_info in modules/ds_search/ds_search.module
Implements hook_search_info().

File

modules/ds_search/ds_search.module, line 156
Display Suite search.

Code

function ds_search_conditions() {
  $conditions = array();

  // Needed for Apache Solr.
  if (!empty($_GET['fq']) && is_array($_GET['fq'])) {
    $conditions['fq'] = $_GET['fq'];
  }

  // Allows for the apachesolr sorting block to work
  if (!empty($_GET['solrsort'])) {
    $conditions['apachesolr_search_sort'] = $_GET['solrsort'];
  }

  // We may also have filters added by facet API module. The 'f'
  // is determined by constant FacetapiAdapter::FILTER_KEY. Hard
  // coded here to avoid extra class loading.
  if (!empty($_GET['f']) && is_array($_GET['f'])) {
    if (module_exists('facetapi')) {
      $conditions['f'] = $_GET['f'];
    }
  }
  if (variable_get('apachesolr_search_browse', 'browse') != 'none') {

    // Set a condition so the search is triggered.
    $conditions['apachesolr_search_browse'] = variable_get('apachesolr_search_browse', 'browse');
  }
  return $conditions;
}