• Welcome to Simple Machines Community Forum. Please login or sign up.
September 21, 2021, 03:54:14 AM

News:

Check out the SMF Function DB!


Blank Search Page

Started by xtom, October 05, 2010, 07:02:56 AM

Previous topic - Next topic

xtom

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?

IceXaos

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.

xtom

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.

sAce

A link to your Site would be helpful.

xtom


Hj Ahmad Rasyid Hj Ismail

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

xtom

I've downloaded the full install zip and uploaded and overwrote the files that you listed. Still the same problem  :(

xtom

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?

Hj Ahmad Rasyid Hj Ismail

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.

xtom

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.

Alex' Manson

October 05, 2010, 11:28:25 AM #10 Last Edit: October 05, 2010, 12:14:36 PM by skander1345
i am having the same problem, but, only admins have this, members CAN search... :(
EDIT: even members cant search now? :o

Hj Ahmad Rasyid Hj Ismail

Try the largest upgrade package again. It might solve your problem.

Alex' Manson

October 05, 2010, 11:31:40 AM #12 Last Edit: October 05, 2010, 11:40:55 AM by skander1345
will it remove my forum mods, for smf rc3, themes ETC?

Hj Ahmad Rasyid Hj Ismail

skander, firstly, don't hijack this post. Secondly, in any upgrade, most mods will be gone unless they are really compatible.

xtom

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

Hj Ahmad Rasyid Hj Ismail

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.

xtom

I'll not do anything drastic and hopefully someone can shed some more light on it. Thanks for the help so far.

xenovanis

Admin -> Forum -> Search -> Search Method, what method is selected?

Are there any errors in your server errorlog regaring this?
"Insanity: doing the same thing over and over again and expecting different results."

xtom

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.

xenovanis

You should be able to access them from your hosts control panel. If not, please ask your host to supply them.
"Insanity: doing the same thing over and over again and expecting different results."

xtom

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']);
        }
    }

xenovanis

Before removing anything, I'd suggest seeing if disabling the spellchecker in Admin -> Forum -> Posts and Topics -> Post settings helps.
"Insanity: doing the same thing over and over again and expecting different results."

xtom

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

xenovanis

Is aspell enabled on your server? Does the spellcheck in posts work for you?
"Insanity: doing the same thing over and over again and expecting different results."

xtom

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.

xenovanis

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.
"Insanity: doing the same thing over and over again and expecting different results."

Alex' Manson

i had this and its fixed when i changed to a better host, its a host problem :P

Aleksi "Lex" Kilpinen

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 :)
A Finnish Project Manager (Support Specialist)
 Happily running multiple SMF 2.x installations.
  Fooling around with i7-10700 @ 2,90GHz-4.80GHz / 16Gb / RTX-2070 Super / 3840x2160 / Win 10 x64


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: