/**
  * Singleton constructor
  * @param sfLucene $search The search instance to tie to
  * @param sfLuceneStorage $writer The writer (optional)
  */
 public function __construct($search, $writer = null)
 {
     if (!$search instanceof sfLucene) {
         throw new sfLuceneException('Search must be an instance of sfLucene');
     }
     if ($writer == null) {
         $writer = new sfLuceneStorageFilesystem(sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . $search->getParameter('index_location') . DIRECTORY_SEPARATOR . 'categories.php');
     }
     if (!$writer instanceof sfLuceneStorage) {
         throw new sfLuceneException('Writer must be an instance of sfLuceneStorage');
     }
     $this->writer = $writer;
     $this->load();
 }