private function IndexPosts()
 {
     require_once "search/blog-post-search-adapter.class.php";
     $this->SearchIndexer()->DeleteFromIndexByType("post");
     $results = $this->GetDataConnection()->query("SELECT id, post_date, CONCAT(DATE_FORMAT(post_date, '/%Y/%m/'), post_name, '/') AS url, post_title, post_content FROM nsa_wp_posts WHERE post_type = 'post' AND post_status = 'publish'");
     while ($row = $results->fetch()) {
         $item = new SearchItem("post", "post" . $row->id, $row->url, $row->post_title);
         $item->FullText($row->post_content);
         $item->ContentDate(new DateTime($row->post_date));
         $adapter = new BlogPostSearchAdapter($item);
         $this->SearchIndexer()->Index($adapter->GetSearchableItem());
     }
     $this->SearchIndexer()->CommitChanges();
 }
 /**
  * Add a WordPress post to search results when it is published
  * @param $post_id int
  */
 public function PublishPost($post_id)
 {
     $post = get_post($post_id);
     require_once "search/mysql-search-indexer.class.php";
     require_once "search/blog-post-search-adapter.class.php";
     require_once "search/search-item.class.php";
     require_once "data/mysql-connection.class.php";
     $search = new MySqlSearchIndexer(new MySqlConnection($this->settings->DatabaseHost(), $this->settings->DatabaseUser(), $this->settings->DatabasePassword(), $this->settings->DatabaseName()));
     $search->DeleteFromIndexById("post" . $post_id);
     $item = new SearchItem("post", $post_id, get_permalink($post_id), $post->post_title);
     $item->ContentDate(new DateTime($post->post_date));
     $item->FullText($post->post_content);
     $adapter = new BlogPostSearchAdapter($item);
     $search->Index($adapter->GetSearchableItem());
     $search->CommitChanges();
 }