Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: xtom on October 05, 2010, 07:02:56 AM

Title: Blank Search Page
Post by: xtom on October 05, 2010, 07:02:56 AM
I'm getting a blank search page when I do a search on my forum, absolutely nothing on it and no source code. Any Ideas what is causing this?
Title: Re: Blank Search Page
Post by: IceXaos on October 05, 2010, 07:09:50 AM
Try clearing your site & browser cache, and doing a search again.  If it's still blank, check the error log, see if anything shows up there.
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 07:26:10 AM
I ran all tasks under forum maintenance including empty file cache but still no go. The error log is empty. Everything seems be working except for blank page search.
Title: Re: Blank Search Page
Post by: sAce on October 05, 2010, 07:44:18 AM
A link to your Site would be helpful.
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 08:06:25 AM
Here's a link to the forum http://www.barter-it.ie/forum/ (http://www.barter-it.ie/forum/)
Title: Re: Blank Search Page
Post by: Hj Ahmad Rasyid Hj Ismail on October 05, 2010, 08:40:14 AM
If you don't modify any of these files, try replacing your current Themes/default/Search.template.php and Sources/Search*.php (4 files) with the default one (from original installation files).
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 08:49:51 AM
I've downloaded the full install zip and uploaded and overwrote the files that you listed. Still the same problem  :(
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 10:41:14 AM
OK I did a fresh install alongside the existing one. Everything works fine even search. So then I change the database name in the admin on the fresh install to use the old database and I'm back to getting the same blank search page. So it must be something botched in the database?
Title: Re: Blank Search Page
Post by: Hj Ahmad Rasyid Hj Ismail on October 05, 2010, 10:53:24 AM
Have you by any chance upgraded your forum before? IMHO that could cause some problems if the database is not fully upgraded. I am lacking of knowledge to troubleshoot database but you could try the (full / largest) upgrade package and see whether that resolve your problem. Back up and create test site to test it. Upgrade must be done on the test site with the old database in use.
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 11:16:28 AM
The forum has been running on rc1.1 for months and I was only aware of the search problem yesterday. This morning I used the large rc3 upgrade prior to posting here thinking it might fix the problem but it hasn't.
Title: Re: Blank Search Page
Post by: Alex' Manson on October 05, 2010, 11:28:25 AM
i am having the same problem, but, only admins have this, members CAN search... :(
EDIT: even members cant search now? :o
Title: Re: Blank Search Page
Post by: Hj Ahmad Rasyid Hj Ismail on October 05, 2010, 11:29:44 AM
Try the largest upgrade package again. It might solve your problem.
Title: Re: Blank Search Page
Post by: Alex' Manson on October 05, 2010, 11:31:40 AM
will it remove my forum mods, for smf rc3, themes ETC?
Title: Re: Blank Search Page
Post by: Hj Ahmad Rasyid Hj Ismail on October 05, 2010, 11:51:40 AM
skander, firstly, don't hijack this post. Secondly, in any upgrade, most mods will be gone unless they are really compatible.
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 11:54:35 AM
Tried the upgrade again but it hasn't fixed the problem  :'( So my options are beginning to look like - A: keep things as they are and sacrifice forum search (which would suck big time) or B: start from scratch with a new database (which would also suck big time). Arggghh
Title: Re: Blank Search Page
Post by: Hj Ahmad Rasyid Hj Ismail on October 05, 2010, 12:01:12 PM
Quote from: ahrasis on October 05, 2010, 10:53:24 AM
I am lacking of knowledge to troubleshoot database...
My guess is your search table may not be fully converted to SMF 2.0 RC3 and is causing that problem. You have to wait or ask somebody with knowledge in database restructuring for SMF 2.0 to resolve this.
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 12:09:25 PM
I'll not do anything drastic and hopefully someone can shed some more light on it. Thanks for the help so far.
Title: Re: Blank Search Page
Post by: xenovanis on October 05, 2010, 03:53:32 PM
Admin -> Forum -> Search -> Search Method, what method is selected?

Are there any errors in your server errorlog regaring this?
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 05:38:24 PM
It's set to no index but I've tried the full/custom index methods and still same problem. I don't think I have access to server errorlogs so I don't know.
Title: Re: Blank Search Page
Post by: xenovanis on October 05, 2010, 05:39:52 PM
You should be able to access them from your hosts control panel. If not, please ask your host to supply them.
Title: Re: Blank Search Page
Post by: xtom on October 05, 2010, 07:47:19 PM
I think I've found the problem at last. It's the spellchecking code in sources/search.php - If I remove the block of code below from around line 777 on this file the search works again, no more blank search page. I think it's the line pspell_new('en'); that causes it to crash to blank screen. Strangly I don't get this problem on a fresh install, only when I use it on my existing database. Anyone know why it's happening exactly? Is it safe to remove this code permanently or is there something else I can do to fix?

    if ($context['show_spellchecking'])
    {
        // Windows fix.
        ob_start();
        $old = error_reporting(0);
        pspell_new('en');
        $pspell_link = pspell_new($txt['lang_dictionary'], $txt['lang_spelling'], '', strtr($txt['lang_character_set'], array('iso-' => 'iso', 'ISO-' => 'iso')), PSPELL_FAST | PSPELL_RUN_TOGETHER);
        error_reporting($old);

        if (!$pspell_link)
            $pspell_link = pspell_new('en', '', '', '', PSPELL_FAST | PSPELL_RUN_TOGETHER);

        ob_end_clean();

        $did_you_mean = array('search' => array(), 'display' => array());
        $found_misspelling = false;
        foreach ($searchArray as $word)
        {
            if (empty($pspell_link))
                continue;

            $word = $word;
            // Don't check phrases.
            if (preg_match('~^\w+$~', $word) === 0)
            {
                $did_you_mean['search'][] = '"' . $word . '"';
                $did_you_mean['display'][] = '"' . $smcFunc['htmlspecialchars']($word) . '"';
                continue;
            }
            // For some strange reason spell check can crash PHP on decimals.
            elseif (preg_match('~\d~', $word) === 1)
            {
                $did_you_mean['search'][] = $word;
                $did_you_mean['display'][] = $smcFunc['htmlspecialchars']($word);
                continue;
            }
            elseif (pspell_check($pspell_link, $word))
            {
                $did_you_mean['search'][] = $word;
                $did_you_mean['display'][] = $smcFunc['htmlspecialchars']($word);
                continue;
            }

            $suggestions = pspell_suggest($pspell_link, $word);
            foreach ($suggestions as $i => $s)
            {
                // Search is case insensitive.
                if ($smcFunc['strtolower']($s) == $smcFunc['strtolower']($word))
                    unset($suggestions[$i]);
                // Plus, don't suggest something the user thinks is rude!
                elseif ($suggestions[$i] != censorText($s))
                    unset($suggestions[$i]);
            }

            // Anything found?  If so, correct it!
            if (!empty($suggestions))
            {
                $suggestions = array_values($suggestions);
                $did_you_mean['search'][] = $suggestions[0];
                $did_you_mean['display'][] = '<em><strong>' . $smcFunc['htmlspecialchars']($suggestions[0]) . '</strong></em>';
                $found_misspelling = true;
            }
            else
            {
                $did_you_mean['search'][] = $word;
                $did_you_mean['display'][] = $smcFunc['htmlspecialchars']($word);
            }
        }

        if ($found_misspelling)
        {
            // Don't spell check excluded words, but add them still...
            $temp_excluded = array('search' => array(), 'display' => array());
            foreach ($excludedWords as $word)
            {
                $word = $word;

                if (preg_match('~^\w+$~', $word) == 0)
                {
                    $temp_excluded['search'][] = '-"' . $word . '"';
                    $temp_excluded['display'][] = '-&quot;' . $smcFunc['htmlspecialchars']($word) . '&quot;';
                }
                else
                {
                    $temp_excluded['search'][] = '-' . $word;
                    $temp_excluded['display'][] = '-' . $smcFunc['htmlspecialchars']($word);
                }
            }

            $did_you_mean['search'] = array_merge($did_you_mean['search'], $temp_excluded['search']);
            $did_you_mean['display'] = array_merge($did_you_mean['display'], $temp_excluded['display']);

            $temp_params = $search_params;
            $temp_params['search'] = implode(' ', $did_you_mean['search']);
            if (isset($temp_params['brd']))
                $temp_params['brd'] = implode(',', $temp_params['brd']);
            $context['params'] = array();
            foreach ($temp_params as $k => $v)
                $context['did_you_mean_params'][] = $k . '|\'|' . $v;
            $context['did_you_mean_params'] = base64_encode(implode('|"|', $context['did_you_mean_params']));
            $context['did_you_mean'] = implode(' ', $did_you_mean['display']);
        }
    }
Title: Re: Blank Search Page
Post by: xenovanis on October 06, 2010, 02:49:54 AM
Before removing anything, I'd suggest seeing if disabling the spellchecker in Admin -> Forum -> Posts and Topics -> Post settings helps.
Title: Re: Blank Search Page
Post by: xtom on October 06, 2010, 04:43:52 AM
Yes disabling the spell check option works, I wasn't even aware it was enabled, thanks. Now if I only thought of this yesterday I could have saved myself a lot of time and trouble :)
Title: Re: Blank Search Page
Post by: xenovanis on October 06, 2010, 04:50:43 AM
Is aspell enabled on your server? Does the spellcheck in posts work for you?
Title: Re: Blank Search Page
Post by: xtom on October 06, 2010, 05:20:02 AM
My phpinfo lists PSpell Support enabled but no mention of aspell. I don't think the spell check works on posts for me either, when I click the spell check button a blank page (that's familiar) in a pop up window appears.
Title: Re: Blank Search Page
Post by: xenovanis on October 06, 2010, 06:31:20 AM
Sorry, I meant pspell.

Probably it's not setup correctly, or, at least not to work with SMF. You might want to try contacting your host about it.
Title: Re: Blank Search Page
Post by: Alex' Manson on October 06, 2010, 08:25:38 AM
i had this and its fixed when i changed to a better host, its a host problem :P
Title: Re: Blank Search Page
Post by: Aleksi "Lex" Kilpinen on October 29, 2010, 05:19:05 AM
Quote from: xtom on October 06, 2010, 04:43:52 AM
Yes disabling the spell check option works, I wasn't even aware it was enabled, thanks. Now if I only thought of this yesterday I could have saved myself a lot of time and trouble :)

Hi, I take it you have been able to find out the cause to your problem, and a way around it - so I'll just mark the topic solved.
If your issue is not solved, and you need further assistance from us - feel free to mark the topic not solved, and update us on the current situation :)