예제 #1
0
 /**
  * Removes a document from the index.
  *
  * @param int $docid
  * @return array containing (content, discussion, title)
  */
 public function deleteDocument($docid)
 {
     $content = '';
     $discussion = '';
     $query = Zend_Search_Lucene_Search_QueryParser::parse('DocumentID:' . PHPLuceneIndexer::longToString($docid));
     $hits = $this->lucene->find($query);
     // there should only be one, but we'll loop for safety
     foreach ($hits as $hit) {
         $content = $hit->Content;
         $discussion = $hit->Discussion;
         $title = $hit->Title;
         $version = $hit->Version;
         $this->lucene->delete($hit);
     }
     return array($content, $discussion, $title, $version);
 }