/** * Executes a query against a Solr server. * * 1) Gets the query string * 2) Conducts the actual search * 3) Checks debug settings * * @param Asm_Solr_Model_Solr_Query $query The query with keywords, filters, and so on. * @param integer $offset Result offset for pagination. * @param integer $limit Maximum number of results to return. If set to NULL, this value is taken from the query object. * @return Asm_Solr_Model_Solr_Response Solr response */ public function search(Asm_Solr_Model_Solr_Query $query, $offset = 0, $limit = 10) { Mage::dispatchEvent('asm_search_query_before', array('query' => $query)); $this->query = $query; if (empty($limit)) { $limit = $query->getResultsPerPage(); } try { $response = $this->connection->search($query->getKeywords(), $offset, $limit, $query->getQueryParameters()); } catch (RuntimeException $e) { $response = $this->connection->getResponse(); } $this->rawResponse = $response; $this->hasSearched = TRUE; return Mage::getModel('solr/solr_response', array('rawResponse' => $response)); }
public function getKeywordsCleaned() { return Asm_Solr_Model_Solr_Query::cleanKeywords($this->getKeywords()); }