kayzhu / LSHash

A fast Python implementation of locality sensitive hashing.
MIT License
660 stars 158 forks source link

lshash use redis #21

Open dontLoveBugs opened 6 years ago

dontLoveBugs commented 6 years ago

from lshash import LSHash lsh = LSHash(6, 8, storage_config={"redis":{"host":'localhost',"port":6379}}) lsh.index([1, 2, 3, 4, 5, 6, 7, 8]) lsh.index([2, 3, 4, 5, 6, 7, 8, 9]) lsh.index([10, 12, 99, 1, 5, 31, 2, 3]) print(lsh.query([1, 2, 3, 4, 5, 6, 7, 7])) image

ziliangok commented 6 years ago

change tuples = json.loads(json_or_tuple)[0] to tuples = json.loads(json_or_tuple) in the source code