fix #315, 实现多词自动搜索

This commit is contained in:
wlx 2012-03-23 06:54:12 +00:00
parent 58374261f4
commit b6b9777f91
1 changed files with 4 additions and 2 deletions

View File

@ -114,8 +114,10 @@ class ServiceController extends Zend_Controller_Action
//$end=$this->_request->getParam('end');
$sql="select id,title,uuid,substring(description for 400) as description,filesize,fileformat from normalmetadata where east<? and west>? and north<? and south>?";
if (!empty($key)) {
$sql.= " and (title ilike ? or description ilike ?)";
$sql.= " order by title";
$search=new Search($key);
$where=$search->sql_expr(array("title","description"));
$sql.= " and ".$where;
$sql.= " order by title";
$rows=$this->db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
} else {
$sql.= " order by title limit 10";