mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
- correctly use DISTINCT and GROUP BY in search related SQL [Bug #1256]
- always display views and replies in search results [Bug #1223] - display error messages occuring during search index creation/deletion [Bug #1274] - correctly align the ACP link on the search results page [Bug #1160] - fixed the search forum box [Bug #1300] and added a search topic box (subBlue: can you please position this a little more visible, didn't want to mess with the CSS ;-)) - correctly check and use show_results on the search page git-svn-id: file:///svn/phpbb/trunk@5727 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -234,7 +234,12 @@ class acp_search
|
||||
if (method_exists($this->search, 'delete_index'))
|
||||
{
|
||||
// pass a reference to myself so the $search object can make use of save_state() and attributes
|
||||
$this->search->delete_index($this, $phpbb_admin_path . "index.$phpEx$SID&i=$id&mode=$mode&action=delete");
|
||||
if ($error = $this->search->delete_index($this, $phpbb_admin_path . "index.$phpEx$SID&i=$id&mode=$mode&action=delete"))
|
||||
{
|
||||
$this->state = array('');
|
||||
$this->save_state();
|
||||
trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,25 +274,23 @@ class acp_search
|
||||
}
|
||||
|
||||
$this->search->tidy();
|
||||
|
||||
|
||||
$this->state = array('');
|
||||
$this->save_state();
|
||||
|
||||
/**
|
||||
* @todo remove Javascript
|
||||
*/
|
||||
trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . '<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
close_waitscreen = 1;
|
||||
//-->
|
||||
</script>');
|
||||
trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (method_exists($this->search, 'create_index'))
|
||||
{
|
||||
// pass a reference to myself so the $search object can make use of save_state() and attributes
|
||||
$this->search->create_index($this, $phpbb_admin_path . "index.$phpEx$SID&i=$id&mode=$mode&action=create");
|
||||
if ($error = $this->search->create_index($this, $phpbb_admin_path . "index.$phpEx$SID&i=$id&mode=$mode&action=create"))
|
||||
{
|
||||
$this->state = array('');
|
||||
$this->save_state();
|
||||
trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -319,14 +322,7 @@ class acp_search
|
||||
$this->state = array('');
|
||||
$this->save_state();
|
||||
|
||||
/**
|
||||
* @todo remove Javascript
|
||||
*/
|
||||
trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . '<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
close_waitscreen = 1;
|
||||
//-->
|
||||
</script>');
|
||||
trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +422,18 @@ class acp_search
|
||||
adm_page_footer();
|
||||
}
|
||||
|
||||
function close_popup_js()
|
||||
{
|
||||
/**
|
||||
* @todo remove Javascript
|
||||
*/
|
||||
return '<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
close_waitscreen = 1;
|
||||
//-->
|
||||
</script>';
|
||||
}
|
||||
|
||||
function get_search_types()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
@@ -40,7 +40,7 @@ class fulltext_mysql extends search_backend
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for correct MySQL version and stores max/min word length in the config
|
||||
* Checks for correct MySQL version and stores min/max word length in the config
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
@@ -61,13 +61,19 @@ class fulltext_mysql extends search_backend
|
||||
}
|
||||
|
||||
$result = $db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\'');
|
||||
$engine = $db->sql_fetchfield('Engine', 0, $result);
|
||||
if (!$engine)
|
||||
{
|
||||
$engine = $db->sql_fetchfield('Type', 0, $result);
|
||||
}
|
||||
$info = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$engine = '';
|
||||
if (isset($info['Engine']))
|
||||
{
|
||||
$engine = $info['Engine'];
|
||||
}
|
||||
else if (isset($info['Type']))
|
||||
{
|
||||
$engine = $info['Type'];
|
||||
}
|
||||
|
||||
if ($engine != 'MyISAM')
|
||||
{
|
||||
return $user->lang['FULLTEXT_MYSQL_NOT_MYISAM'];
|
||||
@@ -160,7 +166,7 @@ class fulltext_mysql extends search_backend
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns text into an array of words that can be stored in the word list table
|
||||
* Turns text into an array of words
|
||||
*/
|
||||
function split_message($text)
|
||||
{
|
||||
@@ -618,9 +624,10 @@ class fulltext_mysql extends search_backend
|
||||
{
|
||||
global $db;
|
||||
|
||||
if (strpos(SQL_LAYER, 'mysql') === false)
|
||||
// Make sure we can actually use MySQL with fulltext indexes
|
||||
if ($error = $this->init())
|
||||
{
|
||||
return $user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_VERSION'];
|
||||
return $error;
|
||||
}
|
||||
|
||||
if (!is_array($this->stats))
|
||||
@@ -648,9 +655,10 @@ class fulltext_mysql extends search_backend
|
||||
{
|
||||
global $db;
|
||||
|
||||
if (strpos(SQL_LAYER, 'mysql') === false)
|
||||
// Make sure we can actually use MySQL with fulltext indexes
|
||||
if ($error = $this->init())
|
||||
{
|
||||
return $user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_VERSION'];
|
||||
return $error;
|
||||
}
|
||||
|
||||
if (!is_array($this->stats))
|
||||
@@ -706,6 +714,12 @@ class fulltext_mysql extends search_backend
|
||||
{
|
||||
global $db;
|
||||
|
||||
if (strpos(SQL_LAYER, 'mysql') === false)
|
||||
{
|
||||
$this->stats = array();
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = 'SHOW INDEX
|
||||
FROM ' . POSTS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
@@ -405,15 +405,15 @@ class fulltext_phpbb extends search_backend
|
||||
|
||||
if ($sql_in)
|
||||
{
|
||||
$sql = "SELECT $sql_select, COUNT(DISTINCT m.word_id) as matches
|
||||
$sql = "SELECT $sql_select, COUNT(DISTINCT m.word_id) as matches, " . $sort_by_sql[$sort_key] . "
|
||||
FROM $sql_from$sql_sort_table" . POSTS_TABLE . ' p, ' . SEARCH_MATCH_TABLE . ' m, ' . SEARCH_WORD_TABLE . " w
|
||||
WHERE w.word_text IN ($sql_in)
|
||||
AND m.word_id = w.word_id
|
||||
AND w.word_common <> 1
|
||||
AND p.post_id = m.post_id
|
||||
$sql_where_options
|
||||
GROUP BY $field
|
||||
ORDER BY $sql_sort";
|
||||
GROUP BY $field, " . $sort_by_sql[$sort_key] . '
|
||||
ORDER BY ' . $sql_sort;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if (!($row = $db->sql_fetchrow($result)))
|
||||
@@ -689,8 +689,8 @@ class fulltext_phpbb extends search_backend
|
||||
AND t.topic_id = p.topic_id
|
||||
$sql_sort_join
|
||||
$sql_time
|
||||
GROUP BY t.topic_id
|
||||
ORDER BY $sql_sort";
|
||||
GROUP BY t.topic_id, " . $sort_by_sql[$sort_key] . '
|
||||
ORDER BY ' . $sql_sort;
|
||||
$field = 'topic_id';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user