Author: rande
Date: 2010-01-12 13:00:18 +0100 (Tue, 12 Jan 2010)
New Revision: 26525

Modified:
   plugins/sfSolrPlugin/branches/sf1.2/lib/indexer/sfLuceneIndexer.class.php
Log:
[sfSolrPlugin] error while saving document is now catched and reported into log

Modified: 
plugins/sfSolrPlugin/branches/sf1.2/lib/indexer/sfLuceneIndexer.class.php
===================================================================
--- plugins/sfSolrPlugin/branches/sf1.2/lib/indexer/sfLuceneIndexer.class.php   
2010-01-12 11:30:14 UTC (rev 26524)
+++ plugins/sfSolrPlugin/branches/sf1.2/lib/indexer/sfLuceneIndexer.class.php   
2010-01-12 12:00:18 UTC (rev 26525)
@@ -50,17 +50,35 @@
 
   /**
    * Saves the record.
+   *
+   * Any errors generated is logged
+   *
+   * @return sfLuceneIndexer
    */
   public function save()
   {
-    $this->delete();
-    $this->insert();
-
+    try
+    {
+      $this->delete();
+      $this->insert();
+    }
+    catch(Exception $e)
+    {
+      $this->getConfiguration()->getEventDispatcher()->notify(
+        new sfEvent($this, 'application.log', array(
+          '{sfSolrPlugin} saving document to index fail : '.$e->getMessage(),
+          'priority' => sfLogger::ALERT
+        ))
+      );
+    }
+    
     return $this;
   }
 
   /**
   * Gets the search instance.
+  *
+  * @return sfLucene
   */
   protected function getSearch()
   {
@@ -68,11 +86,13 @@
   }
 
   /**
-   * Return the context that the search is bound to
+   * Return the sfApplicationConfiguration that the search is bound to
+   *
+   * @return sfApplicationConfiguration
    */
-  protected function getContext()
+  protected function getConfiguration()
   {
-    return $this->search->getContext();
+    return $this->search->getConfiguration();
   }
 
   /**

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to