From 5a3d85745ad5abe8b7e9ae11c062a0a1b4220387 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 2 Apr 2020 16:15:17 +0200 Subject: LCS: output LCS len as well in IDX mode. --- src/t_string.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/t_string.c b/src/t_string.c index 6b30c9751..fb53f7c54 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -602,8 +602,11 @@ void lcsCommand(client *c) { /* Start with a deferred array if we have to emit the ranges. */ uint32_t arraylen = 0; /* Number of ranges emitted in the array. */ - if (getidx && idxkey == NULL) + if (getidx && idxkey == NULL) { + addReplyMapLen(c,2); + addReplyBulkCString(c,"matches"); arraylenptr = addReplyDeferredLen(c); + } i = alen, j = blen; while (computelcs && i > 0 && j > 0) { @@ -669,6 +672,8 @@ void lcsCommand(client *c) { /* Reply depending on the given options. */ if (arraylenptr) { + addReplyBulkCString(c,"len"); + addReplyLongLong(c,LCS(alen,blen)); setDeferredArrayLen(c,arraylenptr,arraylen); } else if (getlen) { addReplyLongLong(c,LCS(alen,blen)); -- cgit v1.2.1