pyredise基于 Redis 的 Python 搜索引擎
pyredise 是一个基于 Python 和 Redis 的简单快速的搜索引擎。
示例代码:
import query_handler
import redis
db = = redis.Redis(host='localhost', port=6379, db=0)
QH = query_handler.QueryHandler(db=db)
# issue some queries, returning a list of tuples such as [(doc_id1, score1), (doc_id2, score2), ...]
print QH.process_query("google security data /pure_tfidf") # ranking only according to tf-idf
print QH.process_query("google security data /complete") # complete
print QH.process_query("google security data /title_only") # search in titles
评论