"treat (space separated) words in search as or'ed search for them individually"

This commit is contained in:
Ralf Becker 2008-06-26 16:08:47 +00:00
parent 5679bdd5f6
commit b3b53c2f87

View File

@ -668,7 +668,10 @@ class so_sql
$criteria[$col] = substr($criteria[$col],1); $criteria[$col] = substr($criteria[$col],1);
$negate = true; $negate = true;
} }
$query[] = ($negate ? ' ('.$db_col.' IS NULL OR ' : '').$db_col.$cmp_op.$this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$criteria[$col]).$wildcard).($negate ? ') ' : ''); foreach(explode(' ',$criteria[$col]) as $crit)
{
$query[] = ($negate ? ' ('.$db_col.' IS NULL OR ' : '').$db_col.$cmp_op.$this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$crit).$wildcard).($negate ? ') ' : '');
}
} }
elseif (strpos($db_col,'.')!==false) // we have a table-name specified elseif (strpos($db_col,'.')!==false) // we have a table-name specified
{ {