summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-04-02 16:15:17 +0200
committerantirez <antirez@gmail.com>2020-04-02 16:15:17 +0200
commit5a3d85745ad5abe8b7e9ae11c062a0a1b4220387 (patch)
tree7dca19677f65cba3c467ff8267751b61ea2644dc
parent3f96e1623d5270714dc94c75ca8d5daab336912c (diff)
downloadredis-5a3d85745ad5abe8b7e9ae11c062a0a1b4220387.tar.gz
LCS: output LCS len as well in IDX mode.
-rw-r--r--src/t_string.c7
1 files changed, 6 insertions, 1 deletions
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));