Author: sevein
Date: Tue Apr 24 09:05:07 2012
New Revision: 11507

Log:
ES pager fixes

Modified:
   branches/2.0/lib/QubitSearchPager.class.php

Modified: branches/2.0/lib/QubitSearchPager.class.php
==============================================================================
--- branches/2.0/lib/QubitSearchPager.class.php Tue Apr 24 09:03:35 2012        
(r11506)
+++ branches/2.0/lib/QubitSearchPager.class.php Tue Apr 24 09:05:07 2012        
(r11507)
@@ -28,6 +28,9 @@
     $this->resultSet = $resultSet;
   }
 
+  /**
+   * @see sfPager
+   */
   public function init()
   {
     $this->setNbResults($this->resultSet->getTotalHits());
@@ -38,43 +41,41 @@
     }
     else
     {
-      $this->setLastPage(ceil($this->getNbResults() / $this->getMAxPerPage()));
+      $this->setLastPage(ceil($this->getNbResults() / $this->getMaxPerPage()));
     }
   }
 
+  /**
+   * @see sfPager
+   */
   public function getResults()
   {
-    if (!isset($this->nbResults))
-    {
-      $this->init();
-    }
-
     return $this->resultSet->getResults();
   }
 
-  public function hasResults()
-  {
-    if (!isset($this->nbResults))
-    {
-      $this->init();
-    }
-
-    return 0 < $this->getNbResults();
-  }
-
+  /**
+   * @see sfPager
+   */
   public function retrieveObject($offset)
   {
     return array_slice($this->getResults, $offset, 1);
   }
 
-  public function setResultSet(Elastica_ResultSet $resultSet)
+  /**
+   * Returns true if the current query has any results
+   *
+   * @return boolean
+   */
+  public function hasResults()
   {
-    $this->resultSet = $resultSet;
+    $this->init();
+
+    return 0 < $this->getNbResults();
   }
 
-  public function getNbResults()
+  public function getFacets()
   {
-    return parent::getNbResults();
+    return $this->resultSet->getFacets();
   }
 
   public function getFacets()

-- 
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