summaryrefslogtreecommitdiffstats
path: root/src/commands/lcs.json
blob: a26b089de0ef40bf90166003aa80a4a0bf4dd55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{
    "LCS": {
        "summary": "Finds the longest common substring.",
        "complexity": "O(N*M) where N and M are the lengths of s1 and s2, respectively",
        "group": "string",
        "since": "7.0.0",
        "arity": -3,
        "function": "lcsCommand",
        "command_flags": [
            "READONLY"
        ],
        "acl_categories": [
            "STRING"
        ],
        "key_specs": [
            {
                "flags": [
                    "RO",
                    "ACCESS"
                ],
                "begin_search": {
                    "index": {
                        "pos": 1
                    }
                },
                "find_keys": {
                    "range": {
                        "lastkey": 1,
                        "step": 1,
                        "limit": 0
                    }
                }
            }
        ],
        "reply_schema": {
            "oneOf": [
                {
                    "type": "string",
                    "description": "The longest common subsequence."
                },
                {
                    "type": "integer",
                    "description": "The length of the longest common subsequence when 'LEN' is given."
                },
                {
                    "type": "object",
                    "description": "Array with the LCS length and all the ranges in both the strings when 'IDX' is given. In RESP2 this is returned as a flat array",
                    "additionalProperties": false,
                    "properties": {
                        "matches": {
                            "type": "array",
                            "items": {
                                "type": "array",
                                "minItems": 2,
                                "maxItems": 3,
                                "items": [
                                    {
                                        "type": "array",
                                        "description": "Matched range in the first string.",
                                        "minItems": 2,
                                        "maxItems": 2,
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    {
                                        "type": "array",
                                        "description": "Matched range in the second string.",
                                        "minItems": 2,
                                        "maxItems": 2,
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                ],
                                "additionalItems": {
                                    "type": "integer",
                                    "description": "The length of the match when 'WITHMATCHLEN' is given."
                                }
                            }
                        },
                        "len": {
                            "type": "integer",
                            "description": "Length of the longest common subsequence."
                        }
                    }
                }
            ]
        },
        "arguments": [
            {
                "name": "key1",
                "type": "key",
                "key_spec_index": 0
            },
            {
                "name": "key2",
                "type": "key",
                "key_spec_index": 0
            },
            {
                "name": "len",
                "token": "LEN",
                "type": "pure-token",
                "optional": true
            },
            {
                "name": "idx",
                "token": "IDX",
                "type": "pure-token",
                "optional": true
            },
            {
                "token": "MINMATCHLEN",
                "name": "min-match-len",
                "type": "integer",
                "optional": true
            },
            {
                "name": "withmatchlen",
                "token": "WITHMATCHLEN",
                "type": "pure-token",
                "optional": true
            }
        ]
    }
}