Search operators
Posted: Thu Feb 25, 2010 9:19 am
Post from a newB. I have a peice of code which as I understand provides the search operators. Currently it only allows for searching one word. I would like for the search to insert % wherever there is a space and at the begining and end of the search.
e.g. 'please search this' would search for '%please%search%this%' .
This may not be enough code to work from or im heading down the wrong route. If so then appologies. Any help appreciated.
e.g. 'please search this' would search for '%please%search%this%' .
This may not be enough code to work from or im heading down the wrong route. If so then appologies. Any help appreciated.
Code: Select all
} else {
$val = CRM_Utils_Type::escape( strtolower(trim($value)), 'String' );
if ( $wildcard ) {
$val = strtolower( addslashes( $val ) );
$val = "%$val%";
$op = 'LIKE';
}
$this->_where[$grouping][] = "{$sql} {$op} '{$val}'";
$this->_qill[$grouping][] = "$field[label] $op $qillValue";
}
}
continue;