public function valid()
{
do {
if ($this->position < count($this->answer['hits'])) {
$this->hit = $this->answer['hits'][$this->position];
$this->position++;
return true;
}
if (isset($this->answer['cursor']) && $this->answer['cursor']) {
$this->position = 0;
$this->doQuery($this->answer['cursor']);
continue;
}
return false;
} while (true);
}