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

Anonymous’s picture

Please mind that although the mentioned issues are marked "closed" or "duplicate", the error actually still exists and nobody ever found a solution.

Jaypan’s picture

I'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.

Jaypan’s picture

I 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.

Jaypan’s picture

I'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.

zyxware’s picture

Status: Active » Postponed (maintainer needs more info)

@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.

Jaypan’s picture

I 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.

Jaypan’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
Anonymous’s picture

Status: Closed (won't fix) » Active

I 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:

Array
(
    [0] => Array
        (
            [title] => Home
            [href] => <front>
            [localized_options] => Array
                (
                )

            [type] => 0
        )

    [1] => 
)

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.

Jaypan’s picture

Actually, 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.

jjesus’s picture

+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.

#0  l(, , ) called at [... drupal/includes/menu.inc:1612]
#1  menu_get_active_breadcrumb() called at [... drupal/includes/common.inc:100]
kenorb’s picture

the same problem

zyxware’s picture

Category: bug » support

The 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

drupal_set_message('arg(): '. var_export(arg(), TRUE));
drupal_set_message('menu_get_active_trail(): '. var_export(menu_get_active_trail(), TRUE));
drupal_set_message('menu_get_active_breadcrumb(): '. var_export(menu_get_active_breadcrumb(), TRUE));

On a default drupal installation with just search404 enabled I get this

arg(): array (
  0 => 'search404',
) 
menu_get_active_trail(): array (
  0 => 
  array (
    'title' => 'Home',
    'href' => '<front>',
    'localized_options' => 
    array (
    ),
    'type' => 0,
  ),
) 
menu_get_active_breadcrumb(): array (
  0 => '<a href="/search404/drupal6/">Home</a>',
) 

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.

naxoc’s picture

I 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:

Array
(
    [0] => Array
        (
            [title] => Forside
            [href] => <front>
            [localized_options] => Array
                (
                )

            [type] => 0
        )

    [1] => 
)

menu_get_active_breadcrumb returns nothing at all.

zyxware’s picture

@naxoc - Can you please track the program flow and try to find where exactly this second item gets into the array.

drupal_set_message('menu_get_active_trail(): '. var_export(menu_get_active_trail(), TRUE));
drupal_set_message('menu_get_active_breadcrumb(): '. var_export(menu_get_active_breadcrumb(), TRUE));

You can try copying the above piece of code across various points in the program flow and catch the place where this happens.

zyxware’s picture

Status: Active » Postponed (maintainer needs more info)
zyxware’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Assuming that this problem no longer exists, I am closing this ticket. If this still persists please feel free to re-open this issue.