Line 96 | Line 96 |
---|
* @param string $phpEx PHP file extension * @param \phpbb\auth\auth $auth Auth object * @param \phpbb\config\config $config Config object
|
* @param string $phpEx PHP file extension * @param \phpbb\auth\auth $auth Auth object * @param \phpbb\config\config $config Config object
|
* @param \phpbb\db\driver\driver_interface Database object
| * @param \phpbb\db\driver\driver_interface $db Database object
|
* @param \phpbb\user $user User object * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object */
| * @param \phpbb\user $user User object * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object */
|
Line 204 | Line 204 |
---|
}
// Filter out as above
|
}
// Filter out as above
|
$split_keywords = preg_replace("#[\"\n\r\t]+#", ' ', trim(htmlspecialchars_decode($keywords)));
| $split_keywords = preg_replace("#[\"\n\r\t]+#", ' ', trim(html_entity_decode($keywords, ENT_COMPAT)));
|
// Split words $split_keywords = preg_replace('#([^\p{L}\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($split_keywords)));
| // Split words $split_keywords = preg_replace('#([^\p{L}\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($split_keywords)));
|
Line 550 | Line 550 |
---|
// if the total result count is not cached yet, retrieve it from the db if (!$result_count) {
|
// if the total result count is not cached yet, retrieve it from the db if (!$result_count) {
|
$sql_count = "SELECT COUNT(*) as result_count
| $sql_count = "SELECT COUNT(DISTINCT " . (($type == 'posts') ? 'p.post_id' : 't.topic_id') . ") as result_count
|
$sql_from $sql_where"; $result = $this->db->sql_query($sql_count);
| $sql_from $sql_where"; $result = $this->db->sql_query($sql_count);
|
Line 836 | Line 836 |
---|
GROUP BY t.topic_id, $sort_by_sql[$sort_key]"; }
|
GROUP BY t.topic_id, $sort_by_sql[$sort_key]"; }
|
$this->db->sql_query($sql_count); $result_count = (int) $this->db->sql_fetchfield('result_count');
| $result = $this->db->sql_query($sql_count); $result_count = ($type == 'posts') ? (int) $this->db->sql_fetchfield('result_count') : count($this->db->sql_fetchrowset($result)); $this->db->sql_freeresult($result);
|
if (!$result_count) {
| if (!$result_count) {
|
Line 972 | Line 973 |
---|
if (!isset($this->stats['post_content'])) {
|
if (!isset($this->stats['post_content'])) {
|
$sql_queries[] = "CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_content ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_text || ' ' || post_subject))";
| $sql_queries[] = "CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_content ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_text))"; }
if (!isset($this->stats['post_subject_content'])) { $sql_queries[] = "CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_subject_content ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_subject || ' ' || post_text))";
|
}
$stats = $this->stats;
| }
$stats = $this->stats;
|
Line 1029 | Line 1035 |
---|
if (isset($this->stats['post_content'])) { $sql_queries[] = 'DROP INDEX ' . $this->stats['post_content']['relname'];
|
if (isset($this->stats['post_content'])) { $sql_queries[] = 'DROP INDEX ' . $this->stats['post_content']['relname'];
|
| }
if (isset($this->stats['post_subject_content'])) { $sql_queries[] = 'DROP INDEX ' . $this->stats['post_subject_content']['relname'];
|
}
$stats = $this->stats;
| }
$stats = $this->stats;
|
Line 1116 | Line 1127 |
---|
else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_content' || $row['relname'] == POSTS_TABLE . '_post_content') { $this->stats['post_content'] = $row;
|
else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_content' || $row['relname'] == POSTS_TABLE . '_post_content') { $this->stats['post_content'] = $row;
|
| } else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_subject_content' || $row['relname'] == POSTS_TABLE . '_post_subject_content') { $this->stats['post_subject_content'] = $row;
|
} } }
| } } }
|