From 0b9e9d00facb24e5edc589106690dcd59aec5910 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Tue, 28 Jul 2020 12:19:21 -0600 Subject: [PATCH] PGSQL requires group by id for book search --- server/controllers/search/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/controllers/search/index.js b/server/controllers/search/index.js index 986e761..1b4a82a 100644 --- a/server/controllers/search/index.js +++ b/server/controllers/search/index.js @@ -48,6 +48,12 @@ class SearchController { [fn('AVG', col('Ratings.rating')), 'averageRating'], ], order: [[col('totalInteractions'), 'DESC']], + group: [ + col('BookReference.id'), + col('Interactions.id'), + col('Reviews.id'), + col('Ratings.id'), + ], }; }