Example #1
0
 /**
  * Add a document to the index.
  * 
  * @return void
  * @access    private
  * @static
  *
  * @author Etienne de Longeaux <*****@*****.**>
  * @since 2012-06-11
  */
 public static function addDocument()
 {
     // Search for documents with the same Key value.
     $term = new \Zend_Search_Lucene_Index_Term(self::$_doc->Key, 'Key');
     $docIds = self::$_index->termDocs($term);
     // Delete any documents found.
     foreach ($docIds as $id) {
         self::$_index->delete($id);
     }
     if (self::$_doc instanceof \Zend_Search_Lucene_Document) {
         self::$_index->addDocument(self::$_doc);
     }
 }