V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
yuptyy
V2EX  ›  Python

redis 查找的问题

  •  
  •   yuptyy · 2015-11-26 15:12:27 +08:00 · 2697 次点击
    这是一个创建于 3066 天前的主题,其中的信息可能已经有所发展或是发生改变。

    redis
    现在有如下数据

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

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

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


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

    https://github.com/newghost/redblade
    xiamingchong
        7
    xiamingchong  
       2015-11-27 09:40:26 +08:00
    上 es 吧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5690 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 01:55 · PVG 09:55 · LAX 18:55 · JFK 21:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.