Retrieve / call facet blocks from non search page I am trying to load full facet blocks on non search page to put them in cache.

What I am doing is looping through items with taxonomy $tid, then

$params = array('fq' =&gt; 'tid:' . $tid);
$current_query = apachesolr_drupal_query('apachesolr', $params, '', 'search/site');
$response = apachesolr_do_query($current_query);
$facet_block = module_invoke('facetapi', 'block_view', $block_id);


When I dsm $response->request, on each iteration I always see the first $tid in the query string ("q.alt=tid..."). The result I get is the same block for every terms, on each apachesolr_do_query requests.

Anyone got a clue on what is going on there ? The purpose of this is to generate cached facet blocks from non search pages, for several tid as the apache solr search parameter.
The problem is, apachesolr_do_query checks if a query has already been made:

apachesolr.module line 1470 :

  // Verify if this query was already executed in the same page load
  if ($response = apachesolr_static_response_cache($searcher)) {
    // Return cached query object
    return array($query, $response);
  }


So, all you have to do to process multiple ApacheSolr queries is to reset the Drupal static variable like so:

drupal_static_reset('apachesolr_static_response_cache');