You are here

function apachesolr_static_response_cache in Apache Solr Search 8

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