/** * Create fulltext index * * @return string|bool error string is returned incase of errors otherwise false */ public function create_index($acp_module, $u_action) { // Make sure we can actually use MySQL with fulltext indexes if ($error = $this->init()) { return $error; } if (empty($this->stats)) { $this->get_stats(); } $alter = array(); if (!isset($this->stats['post_subject'])) { if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { $alter[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; } else { $alter[] = 'MODIFY post_subject text NOT NULL'; } $alter[] = 'ADD FULLTEXT (post_subject)'; } if (!isset($this->stats['post_content'])) { if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { $alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; } else { $alter[] = 'MODIFY post_text mediumtext NOT NULL'; } $alter[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; } if (sizeof($alter)) { $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); } $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); return false; }