public setRandomScore ( integer $seed = null ) | ||
$seed | integer | Set a seed value to return results in the same random order for consistent pagination. |
public function setRandomScore($seed = null)
{
$seedParam = new \stdClass();
if (!is_null($seed)) {
$seedParam->seed = $seed;
}
return $this->setParam('random_score', $seedParam);
}
/** * Get a random quip * * @return ResultSet */ public function getRandom() { $fs = new FunctionScore(); $fs->setRandomScore(); $query = new Query($fs); $query->setFrom(0)->setSize(1)->setFields($this->defaultFields()); return $this->doSearch($query); }