Add rand ordering

This commit is contained in:
Ruben 2016-11-01 21:17:01 +01:00
parent 201681aadb
commit e77b69fbc5

View file

@ -39,7 +39,7 @@ class HitRepository extends EntityRepository
} }
$query = $this->_em->createQuery( $query = $this->_em->createQuery(
"SELECT h, ABS(:score - h.emotions.$emotionField) as HIDDEN distance FROM ".Hit::class." h WHERE h.hasImage = :has ORDER BY distance ASC, RAND() " "SELECT h, ABS(:score - h.emotions.$emotionField) as HIDDEN distance, RAND() AS HIDDEN rand FROM ".Hit::class." h WHERE h.hasImage = :has ORDER BY distance ASC, rand"
) )
->setParameters([ ->setParameters([
'score' => $score, 'score' => $score,