1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-27 20:10:18 +02:00

[ticket/15395] change GIN tsvector indexes in Postgres Fulltext Search

PHPBB3-15395
This commit is contained in:
Kidounet
2020-01-26 13:11:55 +01:00
committed by Marc Alexander
parent ceaf6fcffe
commit a29d2e1149

View File

@@ -972,7 +972,12 @@ class fulltext_postgres extends \phpbb\search\base
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;
@@ -1031,6 +1036,11 @@ class fulltext_postgres extends \phpbb\search\base
$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;
/**
@@ -1117,6 +1127,10 @@ class fulltext_postgres extends \phpbb\search\base
{
$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;
}
}
}
$this->db->sql_freeresult($result);