Page 1 of 1

internal Search function with Wildcards enabled

Posted: Thu Oct 19, 2006 7:55 am
by huedlrick
i wanted to be able to search with wildcards so i changed just two things in 'action.dosearch.php'
i have marked them red. it will now find every word that start with the entered value in the searchfield.
an example: you enter 'Foot' and you will find every word that starts with 'foot' like football, .....

        if ($nb_words > 0)
        {
                #$searchphrase = implode(' OR ', array_fill(0, $nb_words, 'word = ?'));
                $ary = array();
                foreach ($words as $word)
                {
                        $word = trim($word) . "%";
                        $ary[] = "word LIKE " . $db->qstr(htmlentities($word, ENT_COMPAT, 'UTF-8'));
                }
                $searchphrase = implode(' OR ', $ary);

i think that is an useful change for future versions

Re: internal Search function with Wildcards enabled

Posted: Thu Oct 19, 2006 3:56 pm
by tsw
nice, I think it needs a setting "use_wildcards" or something

wanna add a FR in forge so this doesnt get lost in the forum

thanks