Skip to content

Commit 60fd22c

Browse files
committed
have topk info retur a DoubleReply in resp3
1 parent aef901e commit 60fd22c

File tree

1 file changed

+13
-6
lines changed
  • packages/bloom/lib/commands/top-k

1 file changed

+13
-6
lines changed

packages/bloom/lib/commands/top-k/INFO.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ export type TopKInfoReplyMap = TuplesToMapReply<[
77
[SimpleStringReply<'decay'>, DoubleReply]
88
]>;
99

10-
export type TkInfoReply = {
10+
export type TkInfoReply2 = {
1111
k: NumberReply;
1212
width: NumberReply;
1313
depth: NumberReply;
1414
decay: number;
1515
}
16+
17+
export type TkInfoReply3 = {
18+
k: NumberReply;
19+
width: NumberReply;
20+
depth: NumberReply;
21+
decay: DoubleReply;
22+
}
1623

1724
export default {
1825
FIRST_KEY_INDEX: 1,
@@ -21,35 +28,35 @@ export default {
2128
return ['TOPK.INFO', key];
2229
},
2330
transformReply: {
24-
2: (reply: UnwrapReply<Resp2Reply<TopKInfoReplyMap>>): TkInfoReply => {
31+
2: (reply: UnwrapReply<Resp2Reply<TopKInfoReplyMap>>): TkInfoReply2 => {
2532
return {
2633
k: reply[1],
2734
width: reply[3],
2835
depth: reply[5],
2936
decay: Number(reply[7])
3037
};
3138
},
32-
3: (reply: UnwrapReply<TopKInfoReplyMap>): TkInfoReply => {
39+
3: (reply: UnwrapReply<TopKInfoReplyMap>): TkInfoReply3 => {
3340
if (reply instanceof Map) {
3441
return {
3542
k: reply.get('k') as NumberReply,
3643
width: reply.get('width') as NumberReply,
3744
depth: reply.get('depth') as NumberReply,
38-
decay: Number(reply.get('decay') as DoubleReply)
45+
decay: reply.get('decay') as DoubleReply
3946
};
4047
} else if (reply instanceof Array) {
4148
return {
4249
k: reply[1],
4350
width: reply[3],
4451
depth: reply[5],
45-
decay: Number(reply[7])
52+
decay: reply[7]
4653
};
4754
} else {
4855
return {
4956
k: reply['k'],
5057
width: reply['width'],
5158
depth: reply['depth'],
52-
decay: Number(reply['decay'])
59+
decay: reply['decay']
5360
};
5461
}
5562
}

0 commit comments

Comments
 (0)