diff --git a/e107_handlers/search_class.php b/e107_handlers/search_class.php index 63051d666..9dab98f14 100644 --- a/e107_handlers/search_class.php +++ b/e107_handlers/search_class.php @@ -226,7 +226,7 @@ class e_search foreach ($search_fields as $field_key => $field) { - $search_query[] = "(". varset($weights[$field_key],0.6)." * (MATCH(".$field.") AGAINST ('".$this -> query."' IN BOOLEAN MODE)))"; + $search_query[] = "(". varset($weights[$field_key],0.6)." * (MATCH(".$field.") AGAINST ('".str_replace(" ","+",$this -> query)."' IN BOOLEAN MODE)))"; $field_query[] = "MATCH(".$field.") AGAINST ('".$this -> query."' IN BOOLEAN MODE)"; } @@ -239,8 +239,8 @@ class e_search { $sql_order .= ', '.$sort_key.' '.$sort_value; } - - $limit = " LIMIT ".$result_flag.",".$search_res; + + $limit = " LIMIT ".intval($result_flag).",".$search_res; $sql_query = "SELECT SQL_CALC_FOUND_ROWS ".$return_fields.", (".$match_query.") AS relevance FROM #".$table." WHERE ".$where." (".$field_query.") HAVING relevance > 0 ORDER BY relevance DESC ".$sql_order.$limit.";"; @@ -250,7 +250,7 @@ class e_search if(E107_DBG_SQLQUERIES) { - echo e107::getMessage()->addDebug($sql_query)->render(); + echo e107::getMessage()->addDebug(str_replace('#',MPREFIX,$sql_query))->render(); } diff --git a/e107_plugins/download/e_search.php b/e107_plugins/download/e_search.php index 4afe14adb..606cada13 100644 --- a/e107_plugins/download/e_search.php +++ b/e107_plugins/download/e_search.php @@ -46,10 +46,10 @@ class download_search extends e_search // include plugin-folder in the name. 'author'=> array('type' => 'author', 'text' => LAN_SEARCH_61) ), - 'return_fields' => array('d.download_id', 'd.download_sef','d.download_category', 'download_category_id', 'd.download_name', 'd.download_description', 'd.download_author', 'd.download_author_website', 'd.download_datestamp', 'd.download_class', 'c.download_category_name', 'c.download_category_class'), - 'search_fields' => array('d.download_name'=> '1.2', 'd.download_url' => '0.9', 'd.download_description'=>'0.6', 'd.download_author'=>'0.6', 'd.download_author_website'=>'0.4'), // fields and weights. + 'return_fields' => array('d.download_id', 'd.download_sef','d.download_category', 'c.download_category_id', 'd.download_name', 'd.download_description', 'd.download_author', 'd.download_author_website', 'd.download_datestamp', 'd.download_class', 'c.download_category_name', 'c.download_category_class'), + 'search_fields' => array('d.download_name'=> '1.2', 'd.download_url' => '0.9', 'd.download_description'=>'0.6', 'd.download_author'=>'0.6', 'd.download_author_website'=>'0.4'), // fields and weights. - 'order' => array('download_datestamp' => DESC), + 'order' => array('download_datestamp' => 'DESC'), 'refpage' => e_PLUGIN_ABS.'download/download.php' ); @@ -94,7 +94,7 @@ class download_search extends e_search // include plugin-folder in the name. { $tp = e107::getParser(); - $qry = "download_active > '0' AND d.download_visible IN (".USERCLASS_LIST.") AND c.download_category_class IN (".USERCLASS_LIST.") AND".$advanced_where; + $qry = "download_active > '0' AND d.download_visible IN (".USERCLASS_LIST.") AND c.download_category_class IN (".USERCLASS_LIST.") AND"; if (isset($parm['cat']) && is_numeric($parm['cat'])) { diff --git a/search.php b/search.php index 6fa5538c3..dad89db5d 100644 --- a/search.php +++ b/search.php @@ -51,7 +51,8 @@ class search extends e_shortcode private $auto_order = 1000; private $enhanced = false; private $query = null; - private $result_flag = false; + private $doSearch = false; + private $result_flag = 0; // same as 'from' private $message = ''; public $template = array(); private $enhancedTypes = array( @@ -894,7 +895,7 @@ class search extends e_shortcode $_GET = $this->magic_search($_GET); } - $full_query = $tp->filter($_GET['q'],'w'); + $full_query = $tp->filter($_GET['q']); if ($_GET['in']) { @@ -976,8 +977,10 @@ class search extends e_shortcode if ($this->query) { - $this->result_flag = true; // intval($_GET['r']); + $this->result_flag = intval($_GET['r']); + $this->doSearch = true; } + return $this->query; } @@ -988,7 +991,7 @@ class search extends e_shortcode public function doSearch() { - return $this->result_flag; + return $this->doSearch; }