Thread: Search Hangs
View Single Post
Old 03-16-2004, 01:40 AM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. Thanks for the post. Moved to bugs. To fix do the following.

In search_function.php find:
PHP Code:
if (SMALL_WORDS_SIZE >= 1) {
while (
ereg(' ([^ ]{1,'.SMALL_WORDS_SIZE.'}) | ([^ ]{1,'.SMALL_WORDS_SIZE.'})$|^([^ ]{1,'.SMALL_WORDS_SIZE.'}) ',$test_short,$regs)) {
     for (
$n=1$n <=3$n++) {
        if (
$regs[$n]) {
            
$ignore .= "\"".stripslashes($regs[$n])."\", ";
            
$test_short trim(str_replace($regs[$n],"",$test_short));
        }
     }
}

and replace with the following:
PHP Code:
if (SMALL_WORDS_SIZE >= 1) {
while (
ereg('( [^ ]{1,'.SMALL_WORDS_SIZE.'} )|( [^ ]{1,'.SMALL_WORDS_SIZE.'})$|^([^ ]{1,'.SMALL_WORDS_SIZE.'} )',$test_short,$regs)) {
     for (
$n=1$n <=3$n++) {
        if ((
$regs[$n]) || ($reg[$n] == 0)) {
            
$ignore .= "\"".trim(stripslashes($regs[$n]))."\", ";
            
$test_short trim(str_replace($regs[$n],"",$test_short));
        }
     }
}
if (
strlen($test_short) <= SMALL_WORDS_SIZE) {
  if (!
eregi("\"".$test_short."\", ",$ignore)) {
    
$ignore .= "\"".stripslashes($test_short)."\", ";
  }
  
$test_short trim(str_replace($test_short,"",$test_short));
}
}
$ignore str_replace("\"\", ","",$ignore); 
This should prevent the loop as well as correct the display message for too short keywords.

Remember to remove any "word" wrapping in the above code.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote