* (optional) Extra SQL arguments belonging to the second query parameter.
*
* @param $sort_parameters
* (optional) SQL arguments for sorting the final results.
* Default: 'ORDER BY score DESC'
*
* @return
* An array of SIDs for the search results.
*
* @ingroup search
*/
functiondo_search($keywords,$type,$join1='',$where1='1',$arguments1=array(),$select2='i.relevance AS score',$join2='',$arguments2=array()){
functiondo_search($keywords,$type,$join1='',$where1='1',$arguments1=array(),$select2='i.relevance AS score',$join2='',$arguments2=array(),$sort_parameters='ORDER BY score DESC'){
$query=search_parse_query($keywords);
if($query[2]==''){
...
...
@@ -852,7 +856,7 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a
// Second pass: only keep items that match the complicated keywords conditions (phrase search, negative keywords, ...)
$conditions='('.$query[0].')';
$arguments=array_merge($arguments2,$query[1]);
$result=db_query_temporary("SELECT i.type, i.sid, $select2 FROM temp_search_sids i INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type $join2 WHERE $conditionsORDER BY score DESC",$arguments,'temp_search_results');
$result=db_query_temporary("SELECT i.type, i.sid, $select2 FROM temp_search_sids i INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type $join2 WHERE $conditions$sort_parameters",$arguments,'temp_search_results');
if(($count=db_result(db_query('SELECT COUNT(*) FROM temp_search_results')))==0){
returnarray();
}
...
...
@@ -862,7 +866,7 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a
$result=pager_query("SELECT * FROM temp_search_results",10,0,$count_query,$arguments);
* (optional) Extra SQL arguments belonging to the second query parameter.
*
* @param $sort_parameters
* (optional) SQL arguments for sorting the final results.
* Default: 'ORDER BY score DESC'
*
* @return
* An array of SIDs for the search results.
*
* @ingroup search
*/
functiondo_search($keywords,$type,$join1='',$where1='1',$arguments1=array(),$select2='i.relevance AS score',$join2='',$arguments2=array()){
functiondo_search($keywords,$type,$join1='',$where1='1',$arguments1=array(),$select2='i.relevance AS score',$join2='',$arguments2=array(),$sort_parameters='ORDER BY score DESC'){
$query=search_parse_query($keywords);
if($query[2]==''){
...
...
@@ -852,7 +856,7 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a
// Second pass: only keep items that match the complicated keywords conditions (phrase search, negative keywords, ...)
$conditions='('.$query[0].')';
$arguments=array_merge($arguments2,$query[1]);
$result=db_query_temporary("SELECT i.type, i.sid, $select2 FROM temp_search_sids i INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type $join2 WHERE $conditionsORDER BY score DESC",$arguments,'temp_search_results');
$result=db_query_temporary("SELECT i.type, i.sid, $select2 FROM temp_search_sids i INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type $join2 WHERE $conditions$sort_parameters",$arguments,'temp_search_results');
if(($count=db_result(db_query('SELECT COUNT(*) FROM temp_search_results')))==0){
returnarray();
}
...
...
@@ -862,7 +866,7 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a
$result=pager_query("SELECT * FROM temp_search_results",10,0,$count_query,$arguments);