我有这些节点:
user{user_id}: users
thread{thread_id, published_date, like_count, comment_count, view_count}: posts
tag_id{tag_id}: the tag of the post
以及这些关系:
(user) - [: FOLLOWED] -> (tag)
//用户跟随标签(thread) - [: BELONG_TO] -> (tag)
//帖子属于标签(user) - [: READ] -> (thread)
//用户阅读帖子
现在我想查询5篇属于标签的帖子用户关注用户没有阅读该线程,该线程必须是最新的,按点DESC排序。我在用户(user_id(、标签(tag_id(和线程(thread_id(上创建了索引,并从浏览器运行此密码查询:
MATCH (u:User)-[:FOLLOWED]->(t:Tag)<-[:BELONG_TO]-(th)
WHERE u.user_id = 3 AND NOT EXISTS((u)-[:READ]->(th))
WITH u.user_id AS user_id, th.thread_id AS thread_id,
t.tag_id AS tag_id,duration.inDays(datetime(),
datetime(th.published_date)).days AS days,
(0.5*th.like_count + 0.3*th.comment_count + 0.2*th.view_count) AS point
ORDER BY days DESC
RETURN DISTINCT thread_id SKIP 0 LIMIT 5
数据库中只有一个节点(也嵌入了(,耗时235毫秒。显然出了问题。可能是什么问题。Pleace hepl me
在MATCH中,您有一个双向模式。
(t:Tag)<-[:BELONG_TO]->(th)
您是否对:User(User_id(设置了索引或约束?