Recoverable fatal error: Argument 2 passed to apachesolr_search_process_response() must implement interface DrupalSolrQueryInterface, null given in apachesolr_search_process_response()
apachesolr_search_run()
does the following:
list($final_query, $response) = apachesolr_do_query($query);
It then passes $final_query
to apachesolr_search_process_response()
(by default) which, as the error indicates, requires that its $query argument implements DrupalSolrQueryInterface
.
The problem is that if a hook_apachesolr_query_alter()
implementation aborted the query by setting $query->abort_search
to TRUE, then apachesolr_do_query()
returns array(NULL, array());
i.e. $final_query
is NULL, rather than an object implementing DrupalSolrQueryInterface.
Comment | File | Size | Author |
---|---|---|---|
#5 | apachesolr_search-correctly_handle_search_abort-2317711-5.patch | 1.04 KB | Erik Frèrejean |
#4 | apachesolr-abort_search-2317711-4.patch | 748 bytes | jweowu |
Comments
Comment #1
jweowu CreditAttribution: jweowu commentedComment #2
jweowu CreditAttribution: jweowu commentedComment #3
jweowu CreditAttribution: jweowu commentedComment #4
jweowu CreditAttribution: jweowu commentedComment #5
Erik FrèrejeanThe patch by jweowu doesn't actually resolve the issue because the return value of `apachesolr_search_run` is an array containing the search results rather then a response object.
I've attached a patch that returns the correct result set and rectifies the docblock.
Comment #6
jweowu CreditAttribution: jweowu commentedThanks Erik, you're quite right.
It's curious that the initial version wasn't at least throwing a notice somewhere ('empty' objects are neither
empty()
norFALSE
after all, so it wouldn't have been trivially passing a test like that); but it does look very much as if an array is correct here.(Ah. I tracked my lack of errors down to
apachesolr_panels
which does an explicit test foris_array()
!)The new patch looks good to me, and tests fine. I'm calling this RTBC.
Comment #8
japerryHeh that docblock was definitely wrong. Fixed!