/**
  * Returns collection size.
  *
  * @return int
  */
 public function getSize()
 {
     $helper = Mage::helper('smile_elasticsearch');
     if (!$helper->isActiveEngine()) {
         return parent::getSize();
     }
     if (is_null($this->_totalRecords)) {
         $query = clone $this->getSearchEngineQuery();
         $query->setPageParams(0, 0);
         if ($this->getStoreId()) {
             $store = Mage::app()->getStore($this->getStoreId());
             $this->_searchEngineQuery->setLanguageCode(Mage::helper('smile_elasticsearch')->getLanguageCodeByStore($store));
         }
         $query->addFilter('terms', array('store_id' => $this->getStoreId()));
         $result = $query->search();
         $this->_totalRecords = isset($result['total_count']) ? $result['total_count'] : null;
         if (isset($result['facets'])) {
             $this->_facets = array_merge($this->_facets, $result['facets']);
         }
         $this->_isSpellChecked = $query->isSpellchecked();
     }
     return $this->_totalRecords;
 }