isInstantEnabled() public method

public isInstantEnabled ( $storeId = null )
Exemplo n.º 1
0
 /**
  * Call algoliasearch.xml To load js / css / phtml.
  */
 public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
 {
     if ($this->config->isEnabledFrontEnd()) {
         if ($this->config->getApplicationID() && $this->config->getAPIKey()) {
             if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled()) {
                 $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
                 if ($this->config->isDefaultSelector()) {
                     $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_with_topsearch');
                 } else {
                     $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_no_topsearch');
                 }
             }
         }
     }
     return $this;
 }
Exemplo n.º 2
0
 public function getSearchResult($query, $storeId)
 {
     $resultsLimit = $this->config->getResultsLimit($storeId);
     $index_name = $this->product_helper->getIndexName($storeId);
     $number_of_results = 1000;
     if ($this->config->isInstantEnabled()) {
         $number_of_results = min($this->config->getNumberOfProductResults($storeId), 1000);
     }
     $answer = $this->algolia_helper->query($index_name, $query, array('hitsPerPage' => $number_of_results, 'attributesToRetrieve' => 'objectID', 'attributesToHighlight' => '', 'attributesToSnippet' => '', 'numericFilters' => 'visibility_search=1', 'removeWordsIfNoResults' => $this->config->getRemoveWordsIfNoResult($storeId), 'analyticsTags' => 'backend-search'));
     $data = array();
     foreach ($answer['hits'] as $i => $hit) {
         $productId = $hit['objectID'];
         if ($productId) {
             $data[$productId] = $resultsLimit - $i;
         }
     }
     return $data;
 }