From fb676e7dc429e59e9fe5e6c0dd03aa9460bd3e0f Mon Sep 17 00:00:00 2001 From: vins31 Date: Wed, 16 Oct 2013 12:10:54 +0200 Subject: [PATCH] Update lshash.py On the following quick test, I didn't have any extra data. I had to remove the "[0]" to get the proper result. import lsh lsh = lshash.LSHash(hash_size=6,input_dim=8,storage_config={"redis":{"host":"127.0.0.1","port":6380}}) lsh.index([1,2,3,4,5,6,7,8]) lsh.index([2,3,4,5,6,7,8,9]) print lsh.query([1,2,3,4,5,6,7,7]) --- lshash/lshash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lshash/lshash.py b/lshash/lshash.py index 5c895a6..ee538ac 100644 --- a/lshash/lshash.py +++ b/lshash/lshash.py @@ -151,7 +151,7 @@ def _as_np_array(self, json_or_tuple): # JSON-serialized in the case of Redis try: # Return the point stored as list, without the extra data - tuples = json.loads(json_or_tuple)[0] + tuples = json.loads(json_or_tuple) except TypeError: print("The value stored is not JSON-serilizable") raise