I read on the project homepage that Search404 is supposed to integrate with Apache Solr. Sadly it doesnt due to an "unsupported operand types error".
Two issues about this are mentioned at the Apache Solr issue queue. I reported the first one over a year ago.
#550534: Search 404 incompatibility
#342192: "Unsupported operands" thrown in drupal_get_breadcrumb when search404's page is rendered
The issue is caused by calling a failing menu_get_active_breadcrumb()
Someone posted a solution there:
"Best solution right now is to check if we're loading a 404 page, and if so, don't call the menu_get_active_breadcrumb."
Can such a solution be implemented in Search404?
Or has anyone got Search404 working alongside ApacheSolr - if so, please tell me how you did it. Been struggling with this issue for over a year...
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedPlease mind that although the mentioned issues are marked "closed" or "duplicate", the error actually still exists and nobody ever found a solution.
Comment #2
Jaypan CreditAttribution: Jaypan commentedI'm getting this same error, and it has something to do with the breadcrumb, though I am not using apache solr. But it's definitely a breadcrumb issue - i've narrowed it down to that and this module.
Comment #3
Jaypan CreditAttribution: Jaypan commentedI should mention that the way I determined it was this module that was causing the error was to disable the module - when I did that, the error went away. The way I figured out that it was the get_active_breadcrumb() call that it was conflicting with, was to comment out the line of code that calls it - and the error went away. So something in this module definitely conflicts with something in that function.
Comment #4
Jaypan CreditAttribution: Jaypan commentedI've determined that in my case this is a conflict somehow with the simplemenu module. I disabled my modules one at a time until I found the one that resolved the problem. I have opened an issue in that module, here: #812552: Conflict with 404 search module. I'm not sure where the problem lies - whether it be in this module or that one, but I'm hoping you can look into it. It would help me lots.
Comment #5
zyxware CreditAttribution: zyxware commented@Jay Matwichuk - Did you get to the bottom of this issue? From your other posts under simplemenu and morningtime's post under Apache solr it looks like this issue was not caused by search404. It would be great if you can please confirm if that is the case.
Comment #6
Jaypan CreditAttribution: Jaypan commentedI never got to the bottom of it. It was a conflict between the Simplemenu module and the Search404 module, but I couldn't figure out what the conflict was. It must also have had something to do with a 3rd module I'm thinking, as these two modules don't seem to conflict in a clean environment.
Anyways, we can safely close this thread. In the end I stopped using the simplemenu module for this project and went with the Administration Menu module instead, and the problem went away.
Comment #7
Jaypan CreditAttribution: Jaypan commentedComment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedI delved deeper into this issue (took me a while). First of all, I dont know where the bug comes from, what module is responsible, but we need to solve it.
This is the chain of events:
1) search404.module - line 157:
$results = module_invoke($type_search, 'search', 'search', $keys);
2) apachesolr_search.module - line 389
drupal_set_breadcrumb(array_merge(menu_get_active_breadcrumb(), $current_query->get_breadcrumb()));
The problem is that menu_get_active_breadcrumb() returns two array items:
The last one is empty (which leads to a WSOD crash of the l() function in common.inc). Shouldn't this be "Search 404 - Not Found" linked to the search page?
This is why I still think it's an issue with Search404: it doesn't pass its title & page url to the breadcrumb system, or it is somehow lost.
A fix on the ApacheSolr end looks like (line 389) thus removing the get active breadcrumb:
drupal_set_breadcrumb($current_query->get_breadcrumb());
But the fact is that breadcrumb should exist, it's supposed to be the current Search404 page.
Comment #9
Jaypan CreditAttribution: Jaypan commentedActually, as far as I recall, that's essentially what I tracked down the problem as being with the conflict I had as well. An empty array element.
Comment #10
jjesus CreditAttribution: jjesus commented+1. Something about Search404 triggers this problem. When we disable the Search404 module, this problem goes away. On our system, the problem involves menu_get_active_breadcrumb() as others have reported.
Comment #11
kenorb CreditAttribution: kenorb commentedthe same problem
Comment #12
zyxware CreditAttribution: zyxware commentedThe only relevant menu item that search404 has is the 'search404' menu item. This is invoked by changing the current path in the drupal_not_found().
The standard breadcrumb behavior is to not show the current path in the breadcrumb (menu_get_active_breadcrumb() in menu.inc).
So when search404 is shown the breadcrumb shown is only "Home" which is correct. (This is when core search is used for the 404 result page).
menu_get_active_breadcrumb() uses menu_get_active_trail() to generate the breadcrumb.
You can use the following code to see the return values of these functions
On a default drupal installation with just search404 enabled I get this
All of the above seems to be correct.
So I think we will need to debug further to get this working. If somebody with a working solr installation and search404 could chip in with some debugging we could solve this issue.
Comment #13
naxoc CreditAttribution: naxoc commentedI ran into this one too. I have a solr installation and I did some debugging. The thing is I am not sure what I am looking for?
If I call
menu_get_active_trail
in search404.module line 141, I get this:menu_get_active_breadcrumb
returns nothing at all.Comment #14
zyxware CreditAttribution: zyxware commented@naxoc - Can you please track the program flow and try to find where exactly this second item gets into the array.
You can try copying the above piece of code across various points in the program flow and catch the place where this happens.
Comment #15
zyxware CreditAttribution: zyxware commentedComment #16
zyxware CreditAttribution: zyxware commentedAssuming that this problem no longer exists, I am closing this ticket. If this still persists please feel free to re-open this issue.