You are here

function apachesolr_current_query in Apache Solr Search 8

Same name and namespace in other branches
  1. 5.2 apachesolr.module \apachesolr_current_query()
  2. 6.3 apachesolr.module \apachesolr_current_query()
  3. 6 apachesolr.module \apachesolr_current_query()
  4. 6.2 apachesolr.module \apachesolr_current_query()
  5. 7 apachesolr.module \apachesolr_current_query()

Static getter/setter for the current query. Only set once per page.

Parameters

$env_id: Environment from which to save or get the current query

DrupalSolrQueryInterface $query: $query object to save in the static

Return value

DrupalSolrQueryInterface|null return the $query object if it is available in the drupal_static or null otherwise

9 calls to apachesolr_current_query()
ApacheSolrFacetapiAdapter::getSearchKeys in plugins/facetapi/adapter.inc
Returns the search keys.
ApacheSolrFacetapiAdapter::getSearchPath in plugins/facetapi/adapter.inc
Returns the search path.
apachesolr_do_query in ./apachesolr.module
Execute a keyword search based on a query object.
apachesolr_search_block_view in ./apachesolr_search.module
Implements hook_block_view().
apachesolr_search_custom_page_search_form in ./apachesolr_search.pages.inc
Search for placed on user defined search pages.

... See full list

File

./apachesolr.module, line 1661
Integration with the Apache Solr search application.

Code

function apachesolr_current_query($env_id, DrupalSolrQueryInterface $query = NULL) {
  $saved_query =& drupal_static(__FUNCTION__, NULL);
  if (is_object($query)) {
    $saved_query[$env_id] = clone $query;
  }
  if (empty($saved_query[$env_id])) {
    return NULL;
  }
  return is_object($saved_query[$env_id]) ? clone $saved_query[$env_id] : NULL;
}