protected function get_stats()
{
if ($this->db->get_sql_layer() != 'postgres') {
$this->stats = array();
return;
}
$sql = "SELECT c2.relname, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) AS indexdef\n\t\t\t FROM pg_catalog.pg_class c1, pg_catalog.pg_index i, pg_catalog.pg_class c2\n\t\t\t WHERE c1.relname = '" . POSTS_TABLE . "'\n\t\t\t AND pg_catalog.pg_table_is_visible(c1.oid)\n\t\t\t AND c1.oid = i.indrelid\n\t\t\t AND i.indexrelid = c2.oid";
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
// deal with older PostgreSQL versions which didn't use Index_type
if (strpos($row['indexdef'], 'to_tsvector') !== false) {
if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_subject' || $row['relname'] == POSTS_TABLE . '_post_subject') {
$this->stats['post_subject'] = $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;
}
}
}
}
$this->db->sql_freeresult($result);
$this->stats['total_posts'] = $this->config['num_posts'];
}