summaryrefslogtreecommitdiffstats
path: root/src/commands/lcs.json
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/lcs.json')
-rw-r--r--src/commands/lcs.json127
1 files changed, 127 insertions, 0 deletions
diff --git a/src/commands/lcs.json b/src/commands/lcs.json
new file mode 100644
index 0000000..a26b089
--- /dev/null
+++ b/src/commands/lcs.json
@@ -0,0 +1,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
+ }
+ ]
+ }
+}