fix #315, 实现多词自动搜索
This commit is contained in:
parent
58374261f4
commit
b6b9777f91
|
@ -114,8 +114,10 @@ class ServiceController extends Zend_Controller_Action
|
||||||
//$end=$this->_request->getParam('end');
|
//$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>?";
|
$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)) {
|
if (!empty($key)) {
|
||||||
$sql.= " and (title ilike ? or description ilike ?)";
|
$search=new Search($key);
|
||||||
$sql.= " order by title";
|
$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.'%'));
|
$rows=$this->db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
|
||||||
} else {
|
} else {
|
||||||
$sql.= " order by title limit 10";
|
$sql.= " order by title limit 10";
|
||||||
|
|
Loading…
Reference in New Issue