internal Search function with Wildcards enabled
Posted: Thu Oct 19, 2006 7:55 am
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
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