I recently added search 404 to my site, great module and addition for any site.
I have Custom Search installed alongside search 404 (custom search was installed first).
All was peachy in development/testing phase, everything worked, wrong/bad url performed the search and results were found!
When on the production site, it was a different story. When you uncheck 'Rebuild theme registry on every page', that's when the cookie crumbles.
We do have a search 404 page with the keys for the search, the only problem is that it does not perform the search automatically, the end user has to actually click 'search'. I know it's only a minor inconvenience, but I was hoping there was a way to address it, I like the 'automatic' search behaviour. Any ideas?

Thanks,

CommentFileSizeAuthor
#10 custom_search_issue-1212258-10.patch694 bytesmonotaga
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

telegraph’s picture

Category: bug » support
telegraph’s picture

Title: search 404 incompatible with 'custom search' » search 404 incompatible with 'custom search' >> fixed + needs review
Status: Active » Needs review

yay, as per information on http://stackoverflow.com/questions/2051441/drupal-theme-problem
I found a fix to the problem. Just simply add the following:

drupal_load('module','search');
module_load_include('inc','search','search.pages');

before the line (160):

$results = theme('search_results', $results, 'node');

I added mine at the start of the 'else' block after line 151, and then voila, it works perfect.
maybe this'll make it inside the module....

zyxware’s picture

Title: search 404 incompatible with 'custom search' >> fixed + needs review » search 404 does not perform auto search with 'custom search'
Status: Needs review » Active

@telegraph - Don't you have the search module enabled? If so, it should have included the search.module automatically and you wouldn't have to have add the module_include call. So it is possible that the problem lies elsewhere. There is a "Disable auto search" option. Did you check that?

Stephen Ollman’s picture

#2 worked perfectly for us!

zyxware’s picture

@Stephen Ollman - I am not sure if that is the right way to make it work though. The module file should be included by virtue of its being enabled. Is search module enabled?

telegraph’s picture

@zyxware - I have search module enabled - it's a requirement for both search 404 and custom search.
"Disable auto search" is not checked.

I agree search should be available and there should not be a need to call module_include, in fact as mentioned in my first post - it works perfect without any modification if 'Rebuild theme registry on every page' is checked, but once you uncheck that box for your production site, that's it, it's all gone.

In fact you can see this for yourself: if you print_r your results before and after (line 160 in original code i think) $results = theme('search_results', $results, 'node'); you can see that it's an empty array after the theme call.

The stackoverflow page explains this a bit further.... a problem with drupal search module? a problem with the theme or the cache? Who knows, I don't have time, resources or sufficient in depth knowledge to launch myself into that investigation. The solution proposed is just a piece of gum (or a concrete encasement?) to stop the pipe leaking :)

escoles’s picture

Version: 6.x-1.10 » 6.x-1.11

Seeing this issue in 6x-1.11.

MXT’s picture

I have the same problem, but adding the following lines:

drupal_load('module','search');
module_load_include('inc','search','search.pages');

before the existing:

$results = theme('search_results', $results, 'node');

(line 183 in 6.x-1.11 version)

all works fine.

silentway’s picture

Also seeing the problem. Search 404 version 6.x-1.11 with core 6.17. When Custom Search module 6.x-1.9 is turned on, Search 404 just returns a page with no results. When Custom Search module is disabled, Search 404 works as advertised, auto returning search results based on the original url.

monotaga’s picture

I've noticed this as well when Custom Search is on. I'm submitting a patch based on the responses above that's working for me, although this hack probably isn't the best way to actually deal with this problem. Too little time...

Pol’s picture

Same problem in 7.x.

Pol’s picture

Version: 6.x-1.11 » 7.x-1.1
zyxware’s picture

Project: Search 404 » Custom Search

Does custom_search do something that would cause core theme('search_results') to not work correctly? Having custom search enabled with search404 requires the additional inclusion of core search.pages.inc before the theme('search_results') would work. Thanks for your help in advance.

heddn’s picture

Status: Active » Needs review
jdanthinne’s picture

Version: 7.x-1.1 » 7.x-1.12
Status: Needs review » Fixed

Compatibility with Search 404 is working fine in the latest releases.
Feel free to reopen issue if not after upgrading to latest versions.

Automatically closed -- issue fixed for 2 weeks with no activity.

drupalfan81’s picture

This is definitely still an issue. So I will open as you mentioned Jdanthinne.
I am on:
Custom Search 6.x-1.11
Search 404 6.x-1.12

loads the search 404 page with my advanced custom text but doesnt auto search. The user has to click the button or I need to add the hacked code.

drupalfan81’s picture

Thanks telegraph! Your hack worked like a charm. This really should be fixed in the module code though.

drupalfan81’s picture

Version: 7.x-1.12 » 6.x-1.11
Issue summary: View changes
Status: Closed (fixed) » Needs review

This issue is still present with latest version of D6 module version. adding
drupal_load('module','search');
module_load_include('inc','search','search.pages');

before this line does the trick:
$results = theme('search_results', $results, 'node');

jdanthinne’s picture

Can you make a proper patch, please?