* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Result */ /** * Suggester query result * * @package Solarium * @subpackage Result */ class Solarium_Result_Suggester extends Solarium_Result_QueryType implements IteratorAggregate, Countable { /** * Status code returned by Solr * * @var int */ protected $_status; /** * Solr index queryTime * * This doesn't include things like the HTTP responsetime. Purely the Solr * query execution time. * * @var int */ protected $_queryTime; /** * Suggester results * * @var array */ protected $_results; /** * Collation result * * Only available when collate is enabled in the suggester query * * @var string */ protected $_collation; /** * Get Solr status code * * This is not the HTTP status code! The normal value for success is 0. * * @return int */ public function getStatus() { $this->_parseResponse(); return $this->_status; } /** * Get Solr query time * * This doesn't include things like the HTTP responsetime. Purely the Solr * query execution time. * * @return int */ public function getQueryTime() { $this->_parseResponse(); return $this->_queryTime; } /** * Get all results * * @return array */ public function getResults() { $this->_parseResponse(); return $this->_results; } /** * Get results for a specific term * * @param string $term * @return array */ public function getTerm($term) { $this->_parseResponse(); if (isset($this->_results[$term])) { return $this->_results[$term]; } else { return array(); } } /** * IteratorAggregate implementation * * @return ArrayIterator */ public function getIterator() { $this->_parseResponse(); return new ArrayIterator($this->_results); } /** * Countable implementation * * @return int */ public function count() { $this->_parseResponse(); return count($this->_results); } /** * Get collation * * @return null|string */ public function getCollation() { $this->_parseResponse(); return $this->_collation; } }