Algolia_Algoliasearch_Helper_Data::getSearchResult PHP Method

getSearchResult() public method

public getSearchResult ( $query, $storeId )
    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;
    }