fix search's bug

This commit is contained in:
Li Jianxuan 2013-04-27 03:15:51 +00:00
parent ac1c92d9dc
commit 3355712e5f
1 changed files with 16 additions and 16 deletions

View File

@ -79,7 +79,7 @@ class AuthorController extends Zend_Controller_Action
$keywords = $this->_request->getParam('q');
if(!empty($keywords))
$this->view->q = $keywords;
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("m.title","m.description"));
$sql.=' and '.$where;
}
@ -218,7 +218,7 @@ class AuthorController extends Zend_Controller_Action
$keywords = $this->_request->getParam('q');
if(!empty($keywords))
$this->view->q = $keywords;
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$select.=' and '.$where;
}
@ -305,7 +305,7 @@ class AuthorController extends Zend_Controller_Action
$keywords = $this->_request->getParam('q');
if(!empty($keywords))
$this->view->q = $keywords;
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
}
@ -401,9 +401,9 @@ class AuthorController extends Zend_Controller_Action
{
$key = trim($this->_request->getParam('q'));
$this->view->q = $key;
$search=new Search($key);
$where=$search->sql_expr(array("m.title","m.description"));
$sql.=' and '.$where;
$search=new SimpleSearch($key);
$where=$search->sql_expr(array("m.title","m.description"));
$sql.=' and '.$where;
}
$sql.=" ORDER BY a.status DESC,a.id DESC";
@ -777,7 +777,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT m.uuid,m.title,m.description,a.status,a.userid FROM normalmetadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid
WHERE ";
$search=new Search($keyword);
$search=new SimpleSearch($keyword);
$where=$search->sql_expr(array("m.title","m.description"));
$sql.=$where;
$sth = $this->db->prepare($sql);
@ -1253,7 +1253,7 @@ class AuthorController extends Zend_Controller_Action
if(!empty($keyword))
{
$this->view->q = $keyword;
$search = new Search($keyword);
$search = new SimpleSearch($keyword);
$wheresql[] = $search->sql_expr(array("arc.title","arc.description"));
}
@ -1681,7 +1681,7 @@ class AuthorController extends Zend_Controller_Action
WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords))
{
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
}
@ -1853,7 +1853,7 @@ class AuthorController extends Zend_Controller_Action
$row = $sth->fetch();
//update search document
$search=new Search();
$search=new SimpleSearch();
//create search view in xunsearch
//$sql="select m.uuid,m.title,m.description,x.data,array_to_string(ARRAY( SELECT keyword.keyword FROM keyword WHERE keyword.id = m.id), ', '::text) AS keyword from normalmetadata m left join xml x on m.id=x.id where m.uuid=?";
$sql="select * from xunsearch where uuid=?";
@ -2271,7 +2271,7 @@ class AuthorController extends Zend_Controller_Action
if(!empty($keywords))
{
$this->view->q = $keywords;
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("data"));
$sql.=' and '.$where;
}
@ -2298,7 +2298,7 @@ class AuthorController extends Zend_Controller_Action
if(!empty($keywords))
{
$this->view->q = $keywords;
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
}
@ -2646,7 +2646,7 @@ class AuthorController extends Zend_Controller_Action
$this->view->q = $keywords;
if(!empty($keywords))
{
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("r.reference","md.title","md.description"));
$sql.=' and '.$where;
}
@ -2678,7 +2678,7 @@ class AuthorController extends Zend_Controller_Action
WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords))
{
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("r.reference"));
$sql.=' and '.$where;
}
@ -2711,7 +2711,7 @@ class AuthorController extends Zend_Controller_Action
WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords))
{
$search=new Search($keywords);
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
}
@ -2924,7 +2924,7 @@ class AuthorController extends Zend_Controller_Action
if($ac=='search' && !empty($keyword))
{
$this->view->q = $keyword;
$search = new Search($keyword);
$search = new SimpleSearch($keyword);
$wheresql = $search->sql_expr(array("md.title"));
}
if(!empty($wheresql))