twitter4j - Issue in counting relationships for nodes in Neo4j -
i've got neo4j database in hashtags , tweets stored. every tweet has topic
property, defines topic belongs to. if run following query, popular hashtags in db, no matter topic:
match (h:hashtag) return h.text hashtag, size( (h)<--() ) degree order degree desc
i'd popular tags single topic. tried this:
match (h:hashtag)<--(t:tweet{topic:'test'}) return h.text hashtag, size( (h)<--(t) ) degree order degree desc
this
match (h:hashtag) return h.text hashtag, size( (h)<--(t:tweet{topic:'test'}) ) degree order degree desc
while next 1 takes forever run
match (h:hashtag), (t:tweet) t.topic='test' return h.text hashtag, size( (h)<--(t) ) degree order degree desc
what should do? thanks.
in cypher, when return results of aggregation function implicit "group by" whatever returning alongside aggregation function. size()
not aggregation (so you'll size of pattern each row without group by/aggregation), count()
is:
match (t:tweet {topic:'test'})-->(h:hashtag) return h, count(*) num order num desc limit 10
this query counts of tweet
nodes, grouped hashtag
.
Comments
Post a Comment