Skip to content

Commit

Permalink
Fix lowercasing of words in the indexer FS#2270
Browse files Browse the repository at this point in the history
On certain PHP installations (it has been reproduced with PHP version
5.2.0-8+etch11) the indexer failed to lowercase words in the indexer
so the fulltext search was partially broken.
  • Loading branch information
michitux authored and splitbrain committed Jun 14, 2011
1 parent 781f882 commit 458dd6e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions inc/indexer.php
Expand Up @@ -444,9 +444,12 @@ public function tokenizer($text, $wc=false) {
$text = utf8_stripspecials($text, ' ', '\._\-:'.$wc);

$wordlist = explode(' ', $text);
foreach ($wordlist as $i => &$word) {
$word = (preg_match('/[^0-9A-Za-z]/u', $word)) ?
foreach ($wordlist as $i => $word) {
$wordlist[$i] = (preg_match('/[^0-9A-Za-z]/u', $word)) ?
utf8_strtolower($word) : strtolower($word);
}

foreach ($wordlist as $i => $word) {
if ((!is_numeric($word) && strlen($word) < IDX_MINWORDLENGTH)
|| array_search($word, $stopwords) !== false)
unset($wordlist[$i]);
Expand Down

0 comments on commit 458dd6e

Please sign in to comment.