Neo4j 做推荐(加权内容算法)

参考:https://blog.csdn.net/lovehouye/article/details/83505691

https://blog.csdn.net/qq_37503890/article/details/101382876

 

neo4j清空所有节点和关系命令如下:

MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r

 

推荐算法(同行业资讯、同用户、同分类的靠前)

match (m:article_25) where m.title = '安华卫浴第十一届营销战略峰会即将隆重召开'
match (m)-[:hangye]->(g:hangyeinfo)<-[:hangye]-(rec:article_25)
with m,rec,count(*) as gs
optional match (m)-[:user]->(a:userinfo)<-[:user]-(rec)
with m,rec,gs,count(a) as bs
optional match (m)-[:cate]->(d:catinfo)<-[:cate]-(rec)
with m,rec,gs,bs,count(d) as ds
return rec.title as recommentation,rec.hangye,rec.catid,rec.username,(5 * gs) + (3 * bs) + (4 * ds) as score order by score desc,rec.releasetime desc limit 1000

 

posted @ 2022-03-29 11:52  飞鹰之歌  阅读(509)  评论(0)    收藏  举报