Zum Inhalt springen

Indexed Search Bug bei Großbuchstaben am Ende d. Suchworts

Erstellt am 19. August 2004 · 3 Antworten · letzte Antwort am 11. Februar 2005

Tags: Suche, Frage

bnai ·

Hallo,

benutze seit kurzem die Indexed Search Version 1.2.8. Was ich festgestellt habe ist, daß er den letzten Buchstaben des Suchbegriffs abschneidet, wenn es sich um einen Großbuchstaben handelt.

Hat jemand das gleiche Problem und es evtl. schon behoben?

Gruß

bnai

bnai ·

habe den fehler behoben. in der datei "class.tslib_search.php" in der methode split war der fehler:

 function split($origSword, $specchars='+-', $delchars='+-.,')   {
                $sword = $origSword;

                $specs = '['.$this->quotemeta($specchars).']';
                $delchars = '['.$this->quotemeta($delchars).']';

                        // As long as $sword is true (that means $sword MUST be reduced little by little until its empty inside the loop!)
                while ($sword)  {
                        if (ereg('^"',$sword))  {               // There was a double-quote and we will then look for the ending quote.
                                $sword = ereg_replace('^"','',$sword);          // Removes first double-quote
                                ereg('^[^"]*',$sword,$reg);  // Removes everything till next double-quote
                                $value[] = $reg[0];  // reg[0] is the value, should not be trimmed
                                $sword = ereg_replace('^'.$this->quotemeta($reg[0]),'',$sword);
                                $sword = trim(ereg_replace('^"','',$sword));            // Removes last double-quote
                        } elseif (ereg('^'.$specs,$sword,$reg)) {
                                $value[] = $reg[0];
                                $sword = trim(ereg_replace('^'.$specs,'',$sword));              // Removes = sign
                        } elseif (ereg('[+-]',$sword)) {      // Check if $sword contains + or -
                                        // + and - shall only be interpreted as $specchars when there's whitespace before it
                                        // otherwise it's included in the searchword (e.g. "know-how")
                                $a_sword = explode(' ',$sword); // explode $sword to single words
                                $word = array_shift($a_sword);  // get first word
                                $word = ereg_replace($delchars.'$','',$word);           // Delete $delchars at end of string
                                $value[] = $word;       // add searchword to values
                                $sword = implode(' ',$a_sword); // re-build $sword
                        } else {
                                        // There are no double-quotes around the value. Looking for next (space) or special char.
                                ereg('^[^ '.$this->quotemeta($specchars).']*',$sword,$reg);


/* ################# HIER ÄNDERUNG  BEGIN#########################*/

                               $word = trim($reg[0]); //ereg_replace($delchars.'$','',trim($reg[0]));
           
/* ################# HIER ÄNDERUNG  END#########################*/

                                $value[] = $word;
                                $sword = trim(ereg_replace('^'.$this->quotemeta($reg[0]),'',$sword));
                        }
                }

                return $value;
        }

siehe /* ################# HIER ÄNDERUNG BEGIN#########################*/