Alden Bates

Search form returns blank page

Vote 0 Votes

For some time now the search form on my blog hasn't been working, and I can't work out why. If you try to do a search, it thinks for a bit and then comes up with a completely blank page. The searches do appear in the activity log, so the search script is clearly partly working, just not returning a results page.

I upgraded to 4.25 today in the hopes that would fix the problem, and even copied the default search templates over my own, but the problem still occurs.

Everything else is working perfectly. You can see the site at aldenbates.com.

Reported on Movable Type 4.2

11 Replies

| Add a Reply
  • If you do a view-source on the search results page, it is generating HTML. It also appears that you are using the 3.X search templates. Those will probably need to be replaced with the 4.X templates.

  • The default.tmpl in my search_templates directory is the one from the latest release of MT. Is that not what MT uses to generate the search output?

    When I do a view source on the results page, I don't get anything at all (I'm using Firefox - perhaps that's the difference?).

  • Dear Alden,

    Nice to see your here!

    What happens if you just replace your 'search results' system template with say 'X'

    Is this 'X' displaying after you perform a search?

    Cheers,
    Mihai

  • Alden, I've just went to your web site and figured out that your issue is quite simple!

    Just replace your form method from 'post' to 'get'!

    <form method="post" action

    Should become:

    <form method="get" action

    I didn't include your action value to not feed spam boots ;)

    Cheers mate,
    Mihai Bocsaru

  • Oh, hey Mihai!

    I've made the change so the form will do a post, but the search results are still coming up blank. I even tried renaming the template file and it didn't throw an error.

    Further experimentation reveals that the point of failure is when it runs the 'search_post_render' callbacks. An error thrown before then shows up, one immediately afterward doesn't. It looks like the only search_post_render callback set up by default is the _cache_out function in Search.pm. I'm not sure how to go about debugging what it's doing though.

    I've eliminated all plugins from the equation by disabling them one-by-one and attempting searches - no change, so I don't think any of them are adding a callback.

  • Dear Alden,

    Hello to you!

    Well, may I ask how you've upgraded movable type?

    I wonder if maybe an older version file is still in there.

    Can you remove all the mt folders and make sure that you put back a fresh installation of v4.25?

    Kind Regards,
    Mihai Bocsaru

  • To upgrade it, I uploaded a zip file with everything in the right place, expanded it all, and ran the upgrade script.

    I've done as you suggested and completely removed MT, then loaded all the files back on. The problem with the search is still there. This is seriously puzzling!

  • I see. What if you try to perform a search from within the movable type admin? I mean using the internal admin 'search entries' feature?

    Also, have you tried to just place say 'X' on the search results template and see if you get that 'X' on the search results page?

  • The Dashboard search works fine and gives me a list of results.

    I've tried doing a bunch of things to the search results template, including what you suggested there. Even removing the search template altogether doesn't make a difference - not even a "template not found" error.

    So to sum up what we've found out so far: the actual search appears to be working, however something is going wrong as far as loading the template and displaying it. I'm going to take another look at this problem today and see what more I can find out.

  • Some debugging information I logged at the point right before it runs the post render callbacks:
    $method is set to render
    $format and $tmpl_name are both blank.
    $out is an MT::Template object.

    So it seems like the problem could be that $app->param('Template') is returning an empy string, though I'm not sure what it should be returning under normal circumstances. But at any rate, $out->build() is returning an empty string, which is why the search results page is empty.

  • Problem solved!

    So, it turns out that in the "system templates" section of the back end, there's a "Search Results Template", which MT uses either in preference to or instead of the file in the search_templates directory. The template stored in the database was completely blank, which had the result you'd expect. Once I copied my search template into there, the search results started working again.

    So it looks like the problem was caused by an upgrade not correctly loading the search template into the database at some point along the line!

    Thanks to everyone for the help and advice. :)

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

code.sixapart.com

137 479

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

238 797

Last Topic: Manifest Schema Compatibility Issue When Restoring Blog by Matt on Oct 17, 2012

1858 6594

Last Topic: Categories and Basename Publishing Issues by e21media on Oct 25, 2012

88 307

Last Topic: absolute publish date in Manage Entries screen by .mau. on Apr 18, 2012

1488 5347

Last Topic: Anti-cloning by .mau. on Oct 29, 2012

732 3093

Last Topic: Blog moved server - now users cannot access blog? by mowgs on Oct 30, 2012

89 317

Last Topic: How to "pretify" a url in htaccess with a few wildcards by Caio on May 30, 2012

183 771

Last Topic: Commenting with TypePad by Rob Ferrara on Oct 17, 2012

212 680

Last Topic: Does MT-Approval work in MT5? by DLpres on Sep 25, 2012

27 100

Last Topic: Upgrading MT by Caio on Oct 15, 2012

49 224

Last Topic: Movable Type 6 Ideas by Caio on May 28, 2012

65 248

Last Topic: Expanding new rich text editor and implementing table function by Takeshi Nick Osanai on Jul 30, 2012