|
@@ -51,7 +51,7 @@ discard block |
|
|
block discarded – undo |
|
51
|
51
|
*/ |
|
52
|
52
|
public function get_query($topic_id, $topic_title, $length, $sensitivity) |
|
53
|
53
|
{ |
|
54
|
|
- $ts_query_text = $this->db->sql_escape(str_replace(' ', '|', $topic_title)); |
|
|
54
|
+ $ts_query_text = $this->db->sql_escape(str_replace(' ', '|', $topic_title)); |
|
55
|
55
|
|
|
56
|
56
|
return array( |
|
57
|
57
|
'SELECT' => "f.forum_id, f.forum_name, t.*, |
|
@@ -66,7 +66,7 @@ discard block |
|
|
block discarded – undo |
|
66
|
66
|
'ON' => 'f.forum_id = t.forum_id', |
|
67
|
67
|
), |
|
68
|
68
|
), |
|
69
|
|
- 'WHERE' => "ts_rank_cd(to_tsvector('{$this->ts_name}', t.topic_title), '$ts_query_text', 32) >= " . (float) $sensitivity/10 . ' |
|
|
69
|
+ 'WHERE' => "ts_rank_cd(to_tsvector('{$this->ts_name}', t.topic_title), '$ts_query_text', 32) >= " . (float) $sensitivity / 10 . ' |
|
70
|
70
|
AND t.topic_status <> ' . ITEM_MOVED . ' |
|
71
|
71
|
AND t.topic_visibility = ' . ITEM_APPROVED . ' |
|
72
|
72
|
AND t.topic_time > (extract(epoch from current_timestamp)::integer - ' . (int) $length . ') |
|
@@ -122,7 +122,7 @@ discard block |
|
|
block discarded – undo |
|
122
|
122
|
|
|
123
|
123
|
if (!in_array($index, $this->get_pg_indexes())) |
|
124
|
124
|
{ |
|
125
|
|
- $sql = 'CREATE INDEX ' . $index . ' ON ' . TOPICS_TABLE . " USING gin (to_tsvector ('" . $this->ts_name . "', " . $field . '))'; |
|
|
125
|
+ $sql = 'CREATE INDEX ' . $index . ' ON ' . TOPICS_TABLE . " USING gin (to_tsvector ('" . $this->ts_name . "', " . $field . '))'; |
|
126
|
126
|
$this->db->sql_query($sql); |
|
127
|
127
|
} |
|
128
|
128
|
} |