From 435cb9126dedcfeeb9008fc30f9de9791e85609a Mon Sep 17 00:00:00 2001 From: Shaya Potter Date: Thu, 8 Aug 2024 10:07:50 +0300 Subject: [PATCH] understand that null responses can be returned for the key/value array and handle correctly --- packages/search/lib/commands/SEARCH.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/search/lib/commands/SEARCH.ts b/packages/search/lib/commands/SEARCH.ts index ff7ab7e201d..4a647c1e378 100644 --- a/packages/search/lib/commands/SEARCH.ts +++ b/packages/search/lib/commands/SEARCH.ts @@ -73,11 +73,14 @@ export type SearchRawReply = Array; export function transformReply(reply: SearchRawReply, withoutDocuments: boolean): SearchReply { const documents = []; let i = 1; + while (i < reply.length) { documents.push({ - id: reply[i++], - value: withoutDocuments ? Object.create(null) : documentValue(reply[i++]) + id: reply[i], + value: withoutDocuments || reply[i+1] == null ? Object.create(null) : documentValue(reply[i+1]) }); + + i += 2; } return {