You are here

function apachesolr_static_response_cache in Apache Solr Search 7

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

It is important to hold on to the Solr response object for the duration of the page request so that we can use it for things like building facet blocks.

Parameters

$searcher: Name of the searcher - e.g. from $query->getSearcher().

10 calls to apachesolr_static_response_cache()
ApacheSolrFacetapiAdapter::getResultCount in plugins/facetapi/adapter.inc
Returns the number of total results found for the current search.
ApacheSolrFacetapiAdapter::searchExecuted in plugins/facetapi/adapter.inc
Returns a boolean flagging whether $this->_searcher executed a search.
ApacheSolrFacetapiDate::build in plugins/facetapi/query_type_date.inc
Initializes the facet's build array.
ApacheSolrFacetapiGeo::build in plugins/facetapi/query_type_geo.inc
Initializes the facet's build array.
ApacheSolrFacetapiNumericRange::build in plugins/facetapi/query_type_numeric_range.inc
Initializes the facet's build array.

... See full list

File

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

Code

function apachesolr_static_response_cache($searcher, $response = NULL) {
  $_response =& drupal_static(__FUNCTION__, array());
  if (is_object($response)) {
    $_response[$searcher] = clone $response;
  }
  if (!isset($_response[$searcher])) {
    $_response[$searcher] = NULL;
  }
  return $_response[$searcher];
}