On 05/10/2007, Rob Allen <[EMAIL PROTECTED]> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Did you commit() after loop?
You see? I said so it would be a stupid mistake... Thanks! Regards, > > Rob... > > Vincent wrote: > > Hello, > > > > I am currently working on this website where users can add comments to > > messages. At the moment I am trying to allow the admin to delete these > > comments. However, the code I use can't seem to delete this comment from > > my search index. I've been struggling with it for a while now and just > > can't seem to find the answer, so I was hoping to find help here. > > > > This is my current code: > > > > $config = new > > Zend_Config_Ini('./application/config.ini', 'search'); > > $index = Zend_Search_Lucene::open($config->index->path); > > $query = new > Zend_Search_Lucene_Search_Query_MultiTerm(); > > $query->addTerm(new > > Zend_Search_Lucene_Index_Term($this->_request->getParam('id'), > > > > 'comment_id'), true); > > $query->addTerm(new > > Zend_Search_Lucene_Index_Term('comment', 'type'), true); > > $hits = $index->find($query); > > foreach($hits as $hit) > > { > > $index->delete($hit->id); > > } > > > > The opening of the index works as it should, and it even is able to find > > my comments (I'm able to do an echo $hit->comment_id within the foreach > > loop, however, $index->delete($hit->id) doesn't delete the entry. I'm > > probably doing something incredibly stupid here, so I hope that you will > > be able to help me. > > > > Thanks in advance, > > > > -- > > Vincent > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFHBgxz421+qn4cITwRAuz5AJ4nDMELOebWMPWRUDR8YjdoySVdLQCeN6mi > e3KCrQkYaHtOTAquoK/2KO8= > =vSHY > -----END PGP SIGNATURE----- > -- Vincent