我正在使用Redis实现目标搜索 下面是索引广告的功能
def index_ad(conn,id,locations,content,type,value):
pipeline = conn.pipeline(True)
for location in locations:
pipeline.sadd('idx:req:'+location,id)
words = tokenize(content)
for word in words:
pipeline.zadd('idx:'+word,id,0)
rvalue = TO_ECPM[type](1000,AVERAGE_PER_1K.get(type,1),value)
pipeline.hset('type:',id,type)
pipeline.zadd('idx:ad:value:',id,rvalue)
pipeline.zadd('ad:base_value:',id,value)
pipeline.sadd('terms:'+id,*list(words))
pipeline.execute()
我收到以下错误: 管道的命令#3(ZADD idx:look 0 1)导致错误:WRONGTYPE对一个持有错误值的键的操作