public function updateLuceneIndex( &$index = null )
  {

    $index = ($index) ? $index : dsPersonTable::getLuceneIndex();
    //$index = dsPersonTable::getLuceneIndex();
   
    // remove existing entries
    foreach ($index->find('pk:'.$this->getId()) as $hit)
    {
      $index->delete($hit->id);
    }

    // don't index deleted persons
    // obsolete when not using soft-delete
    /*
    if ($this->getDeletedAt())
    {
      return;
    }
    */
    
    $doc = new Zend_Search_Lucene_Document();
   
    // store person primary key to identify it in the search results
    $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId()));

    // index job fields
    $doc->addField(Zend_Search_Lucene_Field::UnStored('firstname', $this->getFirstname(), 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::UnStored('lastname',  $this->getLastname(), 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::UnStored('email',     $this->getEmail(), 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::UnStored('phone',     $this->getPhone(), 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::UnStored('city',      $this->getCity(), 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::UnStored('street',    $this->getStreet(), 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::UnStored('birthday',  $this->getBirthday(), 'utf-8'));
    

    /// CREATING ERROR IN TASK ....


    // add job to the index
    $index->addDocument($doc);
    $index->commit();

    unset( $doc );

  }
  protected function execute($arguments = array(), $options = array())
  {

    // $this->logBlock('DISABLED.', 'ERROR');



    // sfContext::createInstance($this->configuration);
    
    $databaseManager = new sfDatabaseManager($this->configuration);
   
   //var_dump( $this->configuration);


    //$connection = $databaseManager->getDatabase(  )->getConnection();


    // session_write_close(); //now close it, 

   
    // get all contacts
    // loop
    // with:  $contact->updateLuceneIndex()



    // cleanup Lucene index
    $index = dsPersonTable::getLuceneIndex();
   
  
    $q = Doctrine_Core::getTable('dsPerson')
          ->createQuery('a');



   //$q = Doctrine_Query::create();


   //   ->from('dsPerson a')
   //   ->where('j.expires_at < ?', date('Y-m-d'));
   
   
    $contacts = $q->execute();


    $this->logSection('%', sprintf('%d contacts to re-index', $contacts->count() ) );


    foreach ($contacts as $contact)
    {
          $this->logSection('index', $contact ); // ." - memory ". memory_get_usage() 
          $contact->updateLuceneIndex( $index );
          // unset( $contact );
    }
   
   
    //$index->optimize();
   
    $this->logSection('done', 'Rebuilt and optimized the Addressbook index');
   
    // Remove stale jobs
    // $nb = Doctrine_Core::getTable('JobeetJob')->cleanup($options['days']);
   
    // $this->logSection('doctrine', sprintf('Removed %d stale jobs', $nb));
  }