In the latest version of apachesolr, the apachesolr_current_query function must specify the environment to get the query from otherwise it returns NULL.

This patch is not backwards compatible and will require user's to upgrade their version of apachesolr if committed.

Comments

Silicon.Valet’s picture

The apachesolr_has_searched() has to use the environment ID as a first argument as well, might add that to the patch ~line 43 in apachesolr_spellchecker.inc.

I went ahead and replaced the variable_get with an assignment to a local var at the top of the function for legibility eg.

+ $env_id =  variable_get('apachesolr_default_environment', 'default');
-  if (variable_get('apachesolr_search_spellcheck', TRUE) && apachesolr_has_searched() && ($response = apachesolr_static_response_cache($searcher))) {
+  if (variable_get('apachesolr_search_spellcheck', TRUE) && apachesolr_has_searched($env_id) && ($response = apachesolr_static_response_cache($searcher))) {
davidneedham’s picture

Status: Active » Reviewed & tested by the community

This patch works for me!

For reference, here are the errors I used to be getting that this patch fixes:

  • The Apache Solr search engine is not available. Please contact your site administrator.
  • Warning: Missing argument 1 for apachesolr_current_query(), called in ...sites/all/modules/apachesolr_panels/content_types/apachesolr_info.inc on line 32 and defined in apachesolr_current_query() (line 1479 of ...sites/all/modules/apachesolr/apachesolr.module).
  • Notice: Undefined variable: env_id in apachesolr_current_query() (line 1484 of ...sites/all/modules/apachesolr/apachesolr.module).
acbramley’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Commited to 7.x-1.x branch:
Initial patch by Josh Commit 8b551e5
Patch #1 by Silicon.Valet Commit 77aae70