Skip to content

Commit a936fb5

Browse files
committed
Fix hash parsing in search (legacy-proxy)
1 parent b9b7b93 commit a936fb5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

legacy-proxy/proxy.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ def __init__(self, msg):
1111
self.msg = msg
1212

1313

14+
def parse_hashes(src):
15+
return [int(v)&0xffffffff for v in src.split(",")]
16+
17+
1418
class Protocol:
1519

1620
def __init__(self, session):
@@ -61,7 +65,7 @@ async def handle_request(self, request):
6165
raise ProtocolError("invalid command")
6266

6367
if request[0] == "search":
64-
query = list(map(int, request[1].split(",")))
68+
query = parse_hashes(request[1])
6569
results = await self.search(query)
6670
return " ".join(f"{docid}:{hits}" for (docid, hits) in results)
6771

@@ -83,7 +87,7 @@ async def handle_request(self, request):
8387
{
8488
"i": {
8589
"i": int(request[1]),
86-
"h": [int(v)&0xffffffff for v in request[2].split(",")],
90+
"h": parse_hashes(request[2]),
8791
}
8892
}
8993
)

0 commit comments

Comments
 (0)