phpbb\search\fulltext_native::index_remove PHP Method

index_remove() public method

Removes entries from the wordmatch table for the specified post_ids
public index_remove ( $post_ids, $author_ids, $forum_ids )
    public function index_remove($post_ids, $author_ids, $forum_ids)
    {
        if (sizeof($post_ids)) {
            $sql = 'SELECT w.word_id, w.word_text, m.title_match
				FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w
				WHERE ' . $this->db->sql_in_set('m.post_id', $post_ids) . '
					AND w.word_id = m.word_id';
            $result = $this->db->sql_query($sql);
            $message_word_ids = $title_word_ids = $word_texts = array();
            while ($row = $this->db->sql_fetchrow($result)) {
                if ($row['title_match']) {
                    $title_word_ids[] = $row['word_id'];
                } else {
                    $message_word_ids[] = $row['word_id'];
                }
                $word_texts[] = $row['word_text'];
            }
            $this->db->sql_freeresult($result);
            if (sizeof($title_word_ids)) {
                $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
					SET word_count = word_count - 1
					WHERE ' . $this->db->sql_in_set('word_id', $title_word_ids) . '
						AND word_count > 0';
                $this->db->sql_query($sql);
            }
            if (sizeof($message_word_ids)) {
                $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
					SET word_count = word_count - 1
					WHERE ' . $this->db->sql_in_set('word_id', $message_word_ids) . '
						AND word_count > 0';
                $this->db->sql_query($sql);
            }
            unset($title_word_ids);
            unset($message_word_ids);
            $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . '
				WHERE ' . $this->db->sql_in_set('post_id', $post_ids);
            $this->db->sql_query($sql);
        }
        $this->destroy_cache(array_unique($word_texts), array_unique($author_ids));
    }