Make more specific & add option to give number of images

This commit is contained in:
Ruben 2017-09-06 23:12:49 +02:00
parent a48ae893a0
commit 7a1dda439e
2 changed files with 2 additions and 2 deletions

View file

@ -149,7 +149,7 @@ class InterfaceControllerProvider implements ControllerProviderInterface
return $blocks; return $blocks;
}; };
$features = ['brows' => 6, 'nose' => 5, 'mouth' => 8]; $features = ['brows' => $_GET['brows'] ?? 6, 'nose' => $_GET['nose'] ?? 5, 'mouth' => $_GET['mouth'] ?? 8];
$output = []; $output = [];

View file

@ -40,7 +40,7 @@ class HitRepository extends EntityRepository
$query = $this->_em->createQuery( $query = $this->_em->createQuery(
// add BETWEEN so we can use _some_ keying to improve performance. // add BETWEEN so we can use _some_ keying to improve performance.
"SELECT h, ABS(:score - h.emotions.$emotionField) as HIDDEN distance, RAND() AS HIDDEN lala FROM ".Hit::class." h WHERE h.hasImage = :has AND h.emotions.$emotionField BETWEEN :score - 5 AND :score + 5 ORDER BY distance ASC, lala" "SELECT h, ABS(:score - h.emotions.$emotionField) as HIDDEN distance, RAND() AS HIDDEN lala FROM ".Hit::class." h WHERE h.hasImage = :has AND h.emotions.$emotionField BETWEEN :score - 2 AND :score + 2 ORDER BY distance ASC, lala"
) )
->setParameters([ ->setParameters([
'score' => $score, 'score' => $score,