mirror of
https://github.com/e107inc/e107.git
synced 2025-04-21 13:11:52 +02:00
Issue #2478 - Search
This commit is contained in:
parent
edecfea41e
commit
d2db9951a9
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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']))
|
||||
{
|
||||
|
11
search.php
11
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;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user