Format, add DISTINCT for counting
// Q4. Popular topics in a country
-// :param tagClass
-// :param country
-MATCH (:Country {name: $country})<-[:isPartOf]-(:City)<-[:isLocatedIn]-
+/*
+ :param {
+ tagClass: 'MusicalArtist',
+ country: 'Burma'
+ }
+*/
+MATCH
+ (:Country {name: $country})<-[:isPartOf]-(:City)<-[:isLocatedIn]-
(person:Person)<-[:hasModerator]-(forum:Forum)-[:containerOf]->
(post:Post)-[:hasTag]->(:Tag)-[:hasType]->(:TagClass {name: $tagClass})
RETURN
@@ -9,7 +14,7 @@ RETURN
forum.title,
forum.creationDate,
person.id,
- count(post) AS postCount
+ count(DISTINCT post) AS postCount
ORDER BY
postCount DESC,
forum.id ASC
