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,
Comment | File | Size | Author |
---|---|---|---|
#10 | custom_search_issue-1212258-10.patch | 694 bytes | monotaga |
Comments
Comment #1
telegraph CreditAttribution: telegraph commentedComment #2
telegraph CreditAttribution: telegraph commentedyay, 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....
Comment #3
zyxware CreditAttribution: zyxware commented@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?
Comment #4
Stephen Ollman#2 worked perfectly for us!
Comment #5
zyxware CreditAttribution: zyxware commented@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?
Comment #6
telegraph CreditAttribution: telegraph commented@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 :)
Comment #7
escoles CreditAttribution: escoles commentedSeeing this issue in 6x-1.11.
Comment #8
MXTI have the same problem, but adding the following lines:
before the existing:
$results = theme('search_results', $results, 'node');
(line 183 in 6.x-1.11 version)
all works fine.
Comment #9
silentway CreditAttribution: silentway commentedAlso 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.
Comment #10
monotaga CreditAttribution: monotaga commentedI'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...
Comment #11
PolSame problem in 7.x.
Comment #12
PolComment #13
zyxware CreditAttribution: zyxware commentedDoes 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.
Comment #14
heddnComment #15
jdanthinne CreditAttribution: jdanthinne commentedCompatibility with Search 404 is working fine in the latest releases.
Feel free to reopen issue if not after upgrading to latest versions.
Comment #17
drupalfan81 CreditAttribution: drupalfan81 commentedThis 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.
Comment #18
drupalfan81 CreditAttribution: drupalfan81 commentedThanks telegraph! Your hack worked like a charm. This really should be fixed in the module code though.
Comment #19
drupalfan81 CreditAttribution: drupalfan81 commentedThis 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');
Comment #20
jdanthinne CreditAttribution: jdanthinne commentedCan you make a proper patch, please?