redis 查找的问题

2015-11-26 15:12:27 +08:00
 yuptyy

redis
现在有如下数据

tag:userid:1 js php python html
tag:userid:2 php python
tag:userid:3 html php
..
..
..

如何找出有相同兴趣的 比如 同时包含 python 的 key 如何实现?

2751 次点击
所在节点    Python
7 条回复
c4pt0r
2015-11-26 15:14:27 +08:00
你这个想高效,只能反向建索引
nigelvon
2015-11-26 15:15:37 +08:00
这种场景用 redis 不合适。
trigged
2015-11-26 15:19:53 +08:00
冗余,再建一个 set <python>:[uid1,uid2]
xujif
2015-11-26 15:31:32 +08:00
反向索引+1
knightdf
2015-11-26 16:39:25 +08:00
查内容,只能反向索引
newghost
2015-11-26 17:42:28 +08:00
创建一个只有 python 的 set
新建一个 set 或 zset
tag:python user:1 user:2 user:3


redblade 就是用来干这个的, 用 node.js 实现

https://github.com/newghost/redblade
xiamingchong
2015-11-27 09:40:26 +08:00
上 es 吧

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/239111

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX