Author: david
Date: Mon May 14 11:48:36 2012
New Revision: 11675

Log:
Remove ElasticSearch conditionals

Modified:
   trunk/lib/QubitSearch.class.php

Modified: trunk/lib/QubitSearch.class.php
==============================================================================
--- trunk/lib/QubitSearch.class.php     Mon May 14 11:29:25 2012        (r11674)
+++ trunk/lib/QubitSearch.class.php     Mon May 14 11:48:36 2012        (r11675)
@@ -35,15 +35,7 @@
   {
     if (null === self::$_instance)
     {
-      // if the ElasticSearch plugin is enabled, use that instead
-      if (in_array('qtElasticSearchPlugin', 
sfConfig::get('sf_enabled_modules')))
-      {
-        self::$_instance = new qtElasticSearchPlugin();
-      }
-      else
-      {
-        self::$_instance = new self();
-      }
+      self::$_instance = new self();
     }
 
     return self::$_instance;
@@ -51,19 +43,14 @@
 
   public function parse($query)
   {
-    if (self::getInstance() instanceof qtElasticSearchPlugin)
-    {
-      self::getInstance()->parse($query);
-      return;
-    }
-
     // Parse query string
     $query = Zend_Search_Lucene_Search_QueryParser::parse($query, 'UTF-8');
 
     if ($query instanceOf Zend_Search_Lucene_Search_Query_Insignificant) {
-        throw new Exception('No search terms specified.');
-    } elseif ($query instanceOf Zend_Search_Lucene_Search_Query_MultiTerm) {
-        throw new Exception('Error parsing search terms.');
+      throw new Exception('No search terms specified.');
+    }
+    else if ($query instanceOf Zend_Search_Lucene_Search_Query_MultiTerm) {
+      throw new Exception('Error parsing search terms.');
     }
 
     return $query;
@@ -79,11 +66,6 @@
    */
   protected function initialize()
   {
-    if (self::$_instance instanceof qtElasticSearchPlugin)
-    {
-      return;
-    }
-
     $this->setEngine(new 
xfLuceneEngine(sfConfig::get('sf_data_dir').'/index'));
     $this->getEngine()->open();
 
@@ -99,13 +81,6 @@
    */
   public function qubitPopulate($options)
   {
-    if (self::getInstance() instanceof qtElasticSearchPlugin)
-    {
-      self::getInstance()->logger = $this->getLogger();
-      self::getInstance()->qubitPopulate($options);
-      return;
-    }
-
     if (!isset(self::$conn))
     {
       self::$conn = Propel::getConnection();
@@ -169,11 +144,6 @@
 
   public function optimize()
   {
-    if (self::getInstance() instanceof qtElasticSearchPlugin)
-    {
-      return;
-    }
-
     $timer = new QubitTimer;
     $this->getLogger()->log('Optimizing index...', $this->getName());
     $this->getEngine()->optimize();
@@ -205,12 +175,6 @@
    */
   public static function deleteById($id)
   {
-    if (self::getInstance() instanceof qtElasticSearchPlugin)
-    {
-      self::getInstance()->deleteById($id);
-      return;
-    }
-
     // have to use another search object to perform the querying
     $querier = new QubitSearch();
     $query = new Zend_Search_Lucene_Search_Query_Term(new 
Zend_Search_Lucene_Index_Term($id, 'id'));
@@ -311,14 +275,9 @@
     {
       return;
     }
-    // Don't index root object
-    elseif ($term::ROOT_ID == $term->id)
+    else if ($term::ROOT_ID == $term->id)
     {
-      return;
-    }
-    elseif (self::getInstance() instanceof qtElasticSearchPlugin)
-    {
-      self::getInstance()->save($term);
+      // Don't index root object
       return;
     }
   }
@@ -335,14 +294,9 @@
     {
       return;
     }
-    // Don't index root object
-    elseif ($actor::ROOT_ID == $actor->id)
-    {
-      return;
-    }
-    elseif (self::getInstance() instanceof qtElasticSearchPlugin)
+    else if ($actor::ROOT_ID == $actor->id)
     {
-      self::getInstance()->save($actor);
+      // Don't index root object
       return;
     }
 
@@ -406,13 +360,6 @@
 
   public static function deleteInformationObject($informationObject, $options 
= array())
   {
-    if (self::getInstance() instanceof qtElasticSearchPlugin)
-    {
-      self::getInstance()->delete($informationObject);
-
-      return;
-    }
-
     self::deleteById($informationObject->id);
   }
 
@@ -422,14 +369,9 @@
     {
       return;
     }
-    // Only ROOT node should have no parent, don't index
-    elseif (null === $informationObject->parent)
-    {
-      return;
-    }
-    elseif (self::getInstance() instanceof qtElasticSearchPlugin)
+    else if (null === $informationObject->parent)
     {
-      self::getInstance()->save($informationObject);
+      // Only ROOT node should have no parent, don't index
       return;
     }
 

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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/qubit-commits?hl=en.

Reply via email to