Commit 4aa782a8 authored by 赵威's avatar 赵威

save to redis

parent 5d92618d
......@@ -285,6 +285,18 @@ def get_es_answer(keywords, version=False):
if __name__ == "__main__":
print("diary:" + str(get_es_diary(keywords)[:10]) + "\n")
print("tractate: " + str(get_es_tractate(keywords)[:10]) + "\n")
print("answer: " + str(get_es_answer(keywords)[:10]) + "\n")
# print("diary:" + str(get_es_diary(keywords)[:10]) + "\n")
# print("tractate: " + str(get_es_tractate(keywords)[:10]) + "\n")
# print("answer: " + str(get_es_answer(keywords)[:10]) + "\n")
diary_list = get_es_diary(keywords)
tractate_list = get_es_tractate(keywords)
answer_list = get_es_answer(keywords)
redis_client = redis.StrictRedis.from_url("redis://:ReDis!GmTx*0aN9@172.16.40.173:6379")
redis_client.rpush("doris:tag_v3:coldstart:diary", *diary_list)
redis_client.rpush("doris:tag_v3:coldstart:tractate", *tractate_list)
redis_client.rpush("doris:tag_v3:coldstart:answer", *answer_list)
print("diary: " + str(len(diary_list)))
print("tractate: " + str(len(tractate_list)))
print("answer: " + str(len(answer_list)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment