You are here

function apachesolr_current_query in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_current_query()
  2. 5.2 apachesolr.module \apachesolr_current_query()
  3. 6.3 apachesolr.module \apachesolr_current_query()
  4. 6 apachesolr.module \apachesolr_current_query()
  5. 6.2 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

8 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_get_search_suggestions in ./apachesolr_search.module
Retrieve all of the suggestions that were given after a certain search

... See full list

File

./apachesolr.module, line 1699
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;
}