@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $this->container->get('user')->add_lang_ext('vse/similartopics', 'info_acp_similar_topics'); |
| 42 | 42 | $this->container->get('template')->assign_var('L_EXTENSION_ENABLE_SUCCESS', $this->container->get('user')->lang['EXTENSION_ENABLE_SUCCESS'] . |
| 43 | - $this->container->get('user')->lang['PST_LOG_CREATE_INDEX'] ); |
|
| 43 | + $this->container->get('user')->lang['PST_LOG_CREATE_INDEX']); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | return array( |
| 28 | 28 | array('config.add', array('similar_topics_postgres_ts_name', |
| 29 | - ($this->config->offsetExists('fulltext_postgres_ts_name')? $this->config['fulltext_postgres_ts_name'] : 'simple') |
|
| 29 | + ($this->config->offsetExists('fulltext_postgres_ts_name') ? $this->config['fulltext_postgres_ts_name'] : 'simple') |
|
| 30 | 30 | )) |
| 31 | 31 | ); |
| 32 | 32 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if ($fulltext->is_postgres() && !empty($indexes)) |
| 56 | 56 | { |
| 57 | - foreach($indexes as $index) |
|
| 57 | + foreach ($indexes as $index) |
|
| 58 | 58 | { |
| 59 | 59 | $sql = 'DROP INDEX ' . $index; |
| 60 | 60 | $this->db->sql_query($sql); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | if ($this->fulltext->is_postgres()) |
| 175 | 175 | { |
| 176 | 176 | $ts_name = $this->request->variable('pst_postgres_ts_name', |
| 177 | - ($this->config->offsetExists('fulltext_postgres_ts_name')? $this->config['fulltext_postgres_ts_name'] : 'simple')); |
|
| 177 | + ($this->config->offsetExists('fulltext_postgres_ts_name') ? $this->config['fulltext_postgres_ts_name'] : 'simple')); |
|
| 178 | 178 | $this->config->set('similar_topics_postgres_ts_name', $ts_name); |
| 179 | 179 | $this->create_postgres_index($ts_name); |
| 180 | 180 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $indexed = false; |
| 424 | 424 | // Prevent adding extra indeces. |
| 425 | 425 | |
| 426 | - foreach($this->fulltext->get_pg_indexes() as $index) |
|
| 426 | + foreach ($this->fulltext->get_pg_indexes() as $index) |
|
| 427 | 427 | { |
| 428 | 428 | if ($index == TOPICS_TABLE . '_' . $ts_name . '_topic_title') |
| 429 | 429 | { |
@@ -428,7 +428,9 @@ |
||
| 428 | 428 | if ($index == TOPICS_TABLE . '_' . $ts_name . '_topic_title') |
| 429 | 429 | { |
| 430 | 430 | $indexed = true; |
| 431 | - } else { |
|
| 431 | + } |
|
| 432 | + else |
|
| 433 | + { |
|
| 432 | 434 | $sql = 'DROP INDEX ' . $index; |
| 433 | 435 | $this->db->sql_query($sql); |
| 434 | 436 | } |
@@ -140,7 +140,7 @@ |
||
| 140 | 140 | $ts_name = $config['similar_topics_postgres_ts_name']; |
| 141 | 141 | foreach ($this->get_pg_indexes($field) AS $index) |
| 142 | 142 | { |
| 143 | - if ($index == TOPICS_TABLE . '_' . $ts_name . '_' .$field) |
|
| 143 | + if ($index == TOPICS_TABLE . '_' . $ts_name . '_' . $field) |
|
| 144 | 144 | { |
| 145 | 145 | $is_index = true; |
| 146 | 146 | break; |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | { |
| 139 | 139 | global $config; |
| 140 | 140 | $ts_name = $config['similar_topics_postgres_ts_name']; |
| 141 | - foreach ($this->get_pg_indexes($field) AS $index) |
|
| 141 | + foreach ($this->get_pg_indexes($field) as $index) |
|
| 142 | 142 | { |
| 143 | 143 | if ($index == TOPICS_TABLE . '_' . $ts_name . '_' .$field) |
| 144 | 144 | { |
@@ -147,17 +147,17 @@ |
||
| 147 | 147 | $select = $where = $unix_ts = ''; |
| 148 | 148 | if ($this->is_postgres()) |
| 149 | 149 | { |
| 150 | - $ts_query_text = $this->db->sql_escape(str_replace(' ', '|', $topic_title)); |
|
| 150 | + $ts_query_text = $this->db->sql_escape(str_replace(' ', '|', $topic_title)); |
|
| 151 | 151 | $ts_name = $this->config['similar_topics_postgres_ts_name']; |
| 152 | 152 | $select = "f.forum_id, f.forum_name, t.*, |
| 153 | 153 | ts_rank_cd(to_tsvector('$ts_name', t.topic_title), '$ts_query_text', 32) AS score"; |
| 154 | - $where = "ts_rank_cd(to_tsvector('$ts_name', t.topic_title), '$ts_query_text', 32) >= " . (float) $sensitivity ; |
|
| 154 | + $where = "ts_rank_cd(to_tsvector('$ts_name', t.topic_title), '$ts_query_text', 32) >= " . (float) $sensitivity; |
|
| 155 | 155 | $unix_ts = 'extract(epoch from current_timestamp)::integer'; |
| 156 | 156 | } else { |
| 157 | 157 | $select = "f.forum_id, f.forum_name, t.*, |
| 158 | 158 | MATCH (t.topic_title) AGAINST ('" . $this->db->sql_escape($topic_title) . "') AS score"; |
| 159 | 159 | $where = "MATCH (t.topic_title) AGAINST ('" . $this->db->sql_escape($topic_title) . "') >= " . (float) $sensitivity; |
| 160 | - $unix_ts = 'UNIX_TIMESTAMP()'; |
|
| 160 | + $unix_ts = 'UNIX_TIMESTAMP()'; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // Similar Topics query |
@@ -153,7 +153,9 @@ |
||
| 153 | 153 | ts_rank_cd(to_tsvector('$ts_name', t.topic_title), '$ts_query_text', 32) AS score"; |
| 154 | 154 | $where = "ts_rank_cd(to_tsvector('$ts_name', t.topic_title), '$ts_query_text', 32) >= " . (float) $sensitivity ; |
| 155 | 155 | $unix_ts = 'extract(epoch from current_timestamp)::integer'; |
| 156 | - } else { |
|
| 156 | + } |
|
| 157 | + else |
|
| 158 | + { |
|
| 157 | 159 | $select = "f.forum_id, f.forum_name, t.*, |
| 158 | 160 | MATCH (t.topic_title) AGAINST ('" . $this->db->sql_escape($topic_title) . "') AS score"; |
| 159 | 161 | $where = "MATCH (t.topic_title) AGAINST ('" . $this->db->sql_escape($topic_title) . "') >= " . (float) $sensitivity; |