@redis/search 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -0
- package/dist/commands/AGGREGATE.d.ts +114 -0
- package/dist/commands/AGGREGATE.js +162 -0
- package/dist/commands/ALIASADD.d.ts +2 -0
- package/dist/commands/ALIASADD.js +7 -0
- package/dist/commands/ALIASDEL.d.ts +2 -0
- package/dist/commands/ALIASDEL.js +7 -0
- package/dist/commands/ALIASUPDATE.d.ts +2 -0
- package/dist/commands/ALIASUPDATE.js +7 -0
- package/dist/commands/ALTER.d.ts +3 -0
- package/dist/commands/ALTER.js +10 -0
- package/dist/commands/CONFIG_GET.d.ts +6 -0
- package/dist/commands/CONFIG_GET.js +15 -0
- package/dist/commands/CONFIG_SET.d.ts +2 -0
- package/dist/commands/CONFIG_SET.js +7 -0
- package/dist/commands/CREATE.d.ts +21 -0
- package/dist/commands/CREATE.js +56 -0
- package/dist/commands/DICTADD.d.ts +3 -0
- package/dist/commands/DICTADD.js +8 -0
- package/dist/commands/DICTDEL.d.ts +3 -0
- package/dist/commands/DICTDEL.js +8 -0
- package/dist/commands/DICTDUMP.d.ts +2 -0
- package/dist/commands/DICTDUMP.js +7 -0
- package/dist/commands/DROPINDEX.d.ts +6 -0
- package/dist/commands/DROPINDEX.js +11 -0
- package/dist/commands/EXPLAIN.d.ts +9 -0
- package/dist/commands/EXPLAIN.js +14 -0
- package/dist/commands/EXPLAINCLI.d.ts +3 -0
- package/dist/commands/EXPLAINCLI.js +8 -0
- package/dist/commands/INFO.d.ts +120 -0
- package/dist/commands/INFO.js +51 -0
- package/dist/commands/PROFILE_AGGREGATE.d.ts +7 -0
- package/dist/commands/PROFILE_AGGREGATE.js +23 -0
- package/dist/commands/PROFILE_SEARCH.d.ts +8 -0
- package/dist/commands/PROFILE_SEARCH.js +22 -0
- package/dist/commands/SEARCH.d.ts +40 -0
- package/dist/commands/SEARCH.js +28 -0
- package/dist/commands/SPELLCHECK.d.ts +24 -0
- package/dist/commands/SPELLCHECK.js +37 -0
- package/dist/commands/SUGADD.d.ts +7 -0
- package/dist/commands/SUGADD.js +14 -0
- package/dist/commands/SUGDEL.d.ts +2 -0
- package/dist/commands/SUGDEL.js +9 -0
- package/dist/commands/SUGGET.d.ts +7 -0
- package/dist/commands/SUGGET.js +15 -0
- package/dist/commands/SUGGET_WITHPAYLOADS.d.ts +8 -0
- package/dist/commands/SUGGET_WITHPAYLOADS.js +26 -0
- package/dist/commands/SUGGET_WITHSCORES.d.ts +8 -0
- package/dist/commands/SUGGET_WITHSCORES.js +26 -0
- package/dist/commands/SUGGET_WITHSCORES_WITHPAYLOADS.d.ts +7 -0
- package/dist/commands/SUGGET_WITHSCORES_WITHPAYLOADS.js +28 -0
- package/dist/commands/SUGLEN.d.ts +3 -0
- package/dist/commands/SUGLEN.js +8 -0
- package/dist/commands/SYNDUMP.d.ts +2 -0
- package/dist/commands/SYNDUMP.js +7 -0
- package/dist/commands/SYNUPDATE.d.ts +7 -0
- package/dist/commands/SYNUPDATE.js +12 -0
- package/dist/commands/TAGVALS.d.ts +2 -0
- package/dist/commands/TAGVALS.js +7 -0
- package/dist/commands/_LIST.d.ts +2 -0
- package/dist/commands/_LIST.js +7 -0
- package/dist/commands/index.d.ts +240 -0
- package/dist/commands/index.js +409 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +12 -0
- package/package.json +29 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
exports.IS_READ_ONLY = true;
|
|
5
|
+
function transformArguments(index, query) {
|
|
6
|
+
return ['FT.EXPLAINCLI', index, query];
|
|
7
|
+
}
|
|
8
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { RedisCommandArgument } from '@redis/client/dist/lib/commands';
|
|
2
|
+
export declare function transformArguments(index: string): Array<string>;
|
|
3
|
+
declare type InfoRawReply = [
|
|
4
|
+
'index_name',
|
|
5
|
+
RedisCommandArgument,
|
|
6
|
+
'index_options',
|
|
7
|
+
Array<RedisCommandArgument>,
|
|
8
|
+
'index_definition',
|
|
9
|
+
Array<RedisCommandArgument>,
|
|
10
|
+
'attributes',
|
|
11
|
+
Array<Array<RedisCommandArgument>>,
|
|
12
|
+
'num_docs',
|
|
13
|
+
RedisCommandArgument,
|
|
14
|
+
'max_doc_id',
|
|
15
|
+
RedisCommandArgument,
|
|
16
|
+
'num_terms',
|
|
17
|
+
RedisCommandArgument,
|
|
18
|
+
'num_records',
|
|
19
|
+
RedisCommandArgument,
|
|
20
|
+
'inverted_sz_mb',
|
|
21
|
+
RedisCommandArgument,
|
|
22
|
+
'vector_index_sz_mb',
|
|
23
|
+
RedisCommandArgument,
|
|
24
|
+
'total_inverted_index_blocks',
|
|
25
|
+
RedisCommandArgument,
|
|
26
|
+
'offset_vectors_sz_mb',
|
|
27
|
+
RedisCommandArgument,
|
|
28
|
+
'doc_table_size_mb',
|
|
29
|
+
RedisCommandArgument,
|
|
30
|
+
'sortable_values_size_mb',
|
|
31
|
+
RedisCommandArgument,
|
|
32
|
+
'key_table_size_mb',
|
|
33
|
+
RedisCommandArgument,
|
|
34
|
+
'records_per_doc_avg',
|
|
35
|
+
RedisCommandArgument,
|
|
36
|
+
'bytes_per_record_avg',
|
|
37
|
+
RedisCommandArgument,
|
|
38
|
+
'offsets_per_term_avg',
|
|
39
|
+
RedisCommandArgument,
|
|
40
|
+
'offset_bits_per_record_avg',
|
|
41
|
+
RedisCommandArgument,
|
|
42
|
+
'hash_indexing_failures',
|
|
43
|
+
RedisCommandArgument,
|
|
44
|
+
'indexing',
|
|
45
|
+
RedisCommandArgument,
|
|
46
|
+
'percent_indexed',
|
|
47
|
+
RedisCommandArgument,
|
|
48
|
+
'gc_stats',
|
|
49
|
+
[
|
|
50
|
+
'bytes_collected',
|
|
51
|
+
RedisCommandArgument,
|
|
52
|
+
'total_ms_run',
|
|
53
|
+
RedisCommandArgument,
|
|
54
|
+
'total_cycles',
|
|
55
|
+
RedisCommandArgument,
|
|
56
|
+
'average_cycle_time_ms',
|
|
57
|
+
RedisCommandArgument,
|
|
58
|
+
'last_run_time_ms',
|
|
59
|
+
RedisCommandArgument,
|
|
60
|
+
'gc_numeric_trees_missed',
|
|
61
|
+
RedisCommandArgument,
|
|
62
|
+
'gc_blocks_denied',
|
|
63
|
+
RedisCommandArgument
|
|
64
|
+
],
|
|
65
|
+
'cursor_stats',
|
|
66
|
+
[
|
|
67
|
+
'global_idle',
|
|
68
|
+
number,
|
|
69
|
+
'global_total',
|
|
70
|
+
number,
|
|
71
|
+
'index_capacity',
|
|
72
|
+
number,
|
|
73
|
+
'index_total',
|
|
74
|
+
number
|
|
75
|
+
],
|
|
76
|
+
'stopwords_list'?,
|
|
77
|
+
Array<RedisCommandArgument>?
|
|
78
|
+
];
|
|
79
|
+
interface InfoReply {
|
|
80
|
+
indexName: RedisCommandArgument;
|
|
81
|
+
indexOptions: Array<RedisCommandArgument>;
|
|
82
|
+
indexDefinition: Record<string, RedisCommandArgument>;
|
|
83
|
+
attributes: Array<Record<string, RedisCommandArgument>>;
|
|
84
|
+
numDocs: RedisCommandArgument;
|
|
85
|
+
maxDocId: RedisCommandArgument;
|
|
86
|
+
numTerms: RedisCommandArgument;
|
|
87
|
+
numRecords: RedisCommandArgument;
|
|
88
|
+
invertedSzMb: RedisCommandArgument;
|
|
89
|
+
vectorIndexSzMb: RedisCommandArgument;
|
|
90
|
+
totalInvertedIndexBlocks: RedisCommandArgument;
|
|
91
|
+
offsetVectorsSzMb: RedisCommandArgument;
|
|
92
|
+
docTableSizeMb: RedisCommandArgument;
|
|
93
|
+
sortableValuesSizeMb: RedisCommandArgument;
|
|
94
|
+
keyTableSizeMb: RedisCommandArgument;
|
|
95
|
+
recordsPerDocAvg: RedisCommandArgument;
|
|
96
|
+
bytesPerRecordAvg: RedisCommandArgument;
|
|
97
|
+
offsetsPerTermAvg: RedisCommandArgument;
|
|
98
|
+
offsetBitsPerRecordAvg: RedisCommandArgument;
|
|
99
|
+
hashIndexingFailures: RedisCommandArgument;
|
|
100
|
+
indexing: RedisCommandArgument;
|
|
101
|
+
percentIndexed: RedisCommandArgument;
|
|
102
|
+
gcStats: {
|
|
103
|
+
bytesCollected: RedisCommandArgument;
|
|
104
|
+
totalMsRun: RedisCommandArgument;
|
|
105
|
+
totalCycles: RedisCommandArgument;
|
|
106
|
+
averageCycleTimeMs: RedisCommandArgument;
|
|
107
|
+
lastRunTimeMs: RedisCommandArgument;
|
|
108
|
+
gcNumericTreesMissed: RedisCommandArgument;
|
|
109
|
+
gcBlocksDenied: RedisCommandArgument;
|
|
110
|
+
};
|
|
111
|
+
cursorStats: {
|
|
112
|
+
globalIdle: number;
|
|
113
|
+
globalTotal: number;
|
|
114
|
+
indexCapacity: number;
|
|
115
|
+
idnexTotal: number;
|
|
116
|
+
};
|
|
117
|
+
stopWords: Array<RedisCommandArgument> | undefined;
|
|
118
|
+
}
|
|
119
|
+
export declare function transformReply(rawReply: InfoRawReply): InfoReply;
|
|
120
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = void 0;
|
|
4
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
5
|
+
function transformArguments(index) {
|
|
6
|
+
return ['FT.INFO', index];
|
|
7
|
+
}
|
|
8
|
+
exports.transformArguments = transformArguments;
|
|
9
|
+
function transformReply(rawReply) {
|
|
10
|
+
return {
|
|
11
|
+
indexName: rawReply[1],
|
|
12
|
+
indexOptions: rawReply[3],
|
|
13
|
+
indexDefinition: (0, generic_transformers_1.transformTuplesReply)(rawReply[5]),
|
|
14
|
+
attributes: rawReply[7].map(attribute => (0, generic_transformers_1.transformTuplesReply)(attribute)),
|
|
15
|
+
numDocs: rawReply[9],
|
|
16
|
+
maxDocId: rawReply[11],
|
|
17
|
+
numTerms: rawReply[13],
|
|
18
|
+
numRecords: rawReply[15],
|
|
19
|
+
invertedSzMb: rawReply[17],
|
|
20
|
+
vectorIndexSzMb: rawReply[19],
|
|
21
|
+
totalInvertedIndexBlocks: rawReply[21],
|
|
22
|
+
offsetVectorsSzMb: rawReply[23],
|
|
23
|
+
docTableSizeMb: rawReply[25],
|
|
24
|
+
sortableValuesSizeMb: rawReply[27],
|
|
25
|
+
keyTableSizeMb: rawReply[29],
|
|
26
|
+
recordsPerDocAvg: rawReply[31],
|
|
27
|
+
bytesPerRecordAvg: rawReply[33],
|
|
28
|
+
offsetsPerTermAvg: rawReply[35],
|
|
29
|
+
offsetBitsPerRecordAvg: rawReply[37],
|
|
30
|
+
hashIndexingFailures: rawReply[39],
|
|
31
|
+
indexing: rawReply[41],
|
|
32
|
+
percentIndexed: rawReply[43],
|
|
33
|
+
gcStats: {
|
|
34
|
+
bytesCollected: rawReply[45][1],
|
|
35
|
+
totalMsRun: rawReply[45][3],
|
|
36
|
+
totalCycles: rawReply[45][5],
|
|
37
|
+
averageCycleTimeMs: rawReply[45][7],
|
|
38
|
+
lastRunTimeMs: rawReply[45][9],
|
|
39
|
+
gcNumericTreesMissed: rawReply[45][11],
|
|
40
|
+
gcBlocksDenied: rawReply[45][13]
|
|
41
|
+
},
|
|
42
|
+
cursorStats: {
|
|
43
|
+
globalIdle: rawReply[47][1],
|
|
44
|
+
globalTotal: rawReply[47][3],
|
|
45
|
+
indexCapacity: rawReply[47][5],
|
|
46
|
+
idnexTotal: rawReply[47][7]
|
|
47
|
+
},
|
|
48
|
+
stopWords: rawReply[49]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AggregateOptions, AggregateRawReply } from './AGGREGATE';
|
|
2
|
+
import { ProfileOptions, ProfileRawReply, ProfileReply } from '.';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(index: string, query: string, options?: ProfileOptions & AggregateOptions): Array<string>;
|
|
5
|
+
declare type ProfileAggeregateRawReply = ProfileRawReply<AggregateRawReply>;
|
|
6
|
+
export declare function transformReply(reply: ProfileAggeregateRawReply): ProfileReply;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const AGGREGATE_1 = require("./AGGREGATE");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
exports.IS_READ_ONLY = true;
|
|
7
|
+
function transformArguments(index, query, options) {
|
|
8
|
+
const args = ['FT.PROFILE', index, 'AGGREGATE'];
|
|
9
|
+
if (options?.LIMITED) {
|
|
10
|
+
args.push('LIMITED');
|
|
11
|
+
}
|
|
12
|
+
args.push('QUERY', query);
|
|
13
|
+
(0, AGGREGATE_1.pushAggregatehOptions)(args, options);
|
|
14
|
+
return args;
|
|
15
|
+
}
|
|
16
|
+
exports.transformArguments = transformArguments;
|
|
17
|
+
function transformReply(reply) {
|
|
18
|
+
return {
|
|
19
|
+
results: (0, AGGREGATE_1.transformReply)(reply[0]),
|
|
20
|
+
profile: (0, _1.transformProfile)(reply[1])
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SearchOptions, SearchRawReply } from './SEARCH';
|
|
2
|
+
import { ProfileOptions, ProfileRawReply, ProfileReply } from '.';
|
|
3
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
4
|
+
export declare const IS_READ_ONLY = true;
|
|
5
|
+
export declare function transformArguments(index: string, query: string, options?: ProfileOptions & SearchOptions): RedisCommandArguments;
|
|
6
|
+
declare type ProfileSearchRawReply = ProfileRawReply<SearchRawReply>;
|
|
7
|
+
export declare function transformReply(reply: ProfileSearchRawReply): ProfileReply;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const SEARCH_1 = require("./SEARCH");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
exports.IS_READ_ONLY = true;
|
|
7
|
+
function transformArguments(index, query, options) {
|
|
8
|
+
const args = ['FT.PROFILE', index, 'SEARCH'];
|
|
9
|
+
if (options?.LIMITED) {
|
|
10
|
+
args.push('LIMITED');
|
|
11
|
+
}
|
|
12
|
+
args.push('QUERY', query);
|
|
13
|
+
return (0, _1.pushSearchOptions)(args, options);
|
|
14
|
+
}
|
|
15
|
+
exports.transformArguments = transformArguments;
|
|
16
|
+
function transformReply(reply) {
|
|
17
|
+
return {
|
|
18
|
+
results: (0, SEARCH_1.transformReply)(reply[0]),
|
|
19
|
+
profile: (0, _1.transformProfile)(reply[1])
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { RedisSearchLanguages, Params, PropertyName, SortByProperty, SearchReply } from '.';
|
|
3
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
4
|
+
export declare const IS_READ_ONLY = true;
|
|
5
|
+
export interface SearchOptions {
|
|
6
|
+
VERBATIM?: true;
|
|
7
|
+
NOSTOPWORDS?: true;
|
|
8
|
+
WITHSORTKEYS?: true;
|
|
9
|
+
INKEYS?: string | Array<string>;
|
|
10
|
+
INFIELDS?: string | Array<string>;
|
|
11
|
+
RETURN?: string | Array<string>;
|
|
12
|
+
SUMMARIZE?: true | {
|
|
13
|
+
FIELDS?: PropertyName | Array<PropertyName>;
|
|
14
|
+
FRAGS?: number;
|
|
15
|
+
LEN?: number;
|
|
16
|
+
SEPARATOR?: string;
|
|
17
|
+
};
|
|
18
|
+
HIGHLIGHT?: true | {
|
|
19
|
+
FIELDS?: PropertyName | Array<PropertyName>;
|
|
20
|
+
TAGS?: {
|
|
21
|
+
open: string;
|
|
22
|
+
close: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
SLOP?: number;
|
|
26
|
+
INORDER?: true;
|
|
27
|
+
LANGUAGE?: RedisSearchLanguages;
|
|
28
|
+
EXPANDER?: string;
|
|
29
|
+
SCORER?: string;
|
|
30
|
+
SORTBY?: SortByProperty;
|
|
31
|
+
LIMIT?: {
|
|
32
|
+
from: number | string;
|
|
33
|
+
size: number | string;
|
|
34
|
+
};
|
|
35
|
+
PARAMS?: Params;
|
|
36
|
+
DIALECT?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function transformArguments(index: string, query: string, options?: SearchOptions): RedisCommandArguments;
|
|
39
|
+
export declare type SearchRawReply = Array<any>;
|
|
40
|
+
export declare function transformReply(reply: SearchRawReply): SearchReply;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
7
|
+
exports.IS_READ_ONLY = true;
|
|
8
|
+
function transformArguments(index, query, options) {
|
|
9
|
+
return (0, _1.pushSearchOptions)(['FT.SEARCH', index, query], options);
|
|
10
|
+
}
|
|
11
|
+
exports.transformArguments = transformArguments;
|
|
12
|
+
function transformReply(reply) {
|
|
13
|
+
const documents = [];
|
|
14
|
+
for (let i = 1; i < reply.length; i += 2) {
|
|
15
|
+
const tuples = reply[i + 1];
|
|
16
|
+
documents.push({
|
|
17
|
+
id: reply[i],
|
|
18
|
+
value: tuples.length === 2 && tuples[0] === '$' ?
|
|
19
|
+
JSON.parse(tuples[1]) :
|
|
20
|
+
(0, generic_transformers_1.transformTuplesReply)(tuples)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
total: reply[0],
|
|
25
|
+
documents
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface SpellCheckTerms {
|
|
2
|
+
mode: 'INCLUDE' | 'EXCLUDE';
|
|
3
|
+
dictionary: string;
|
|
4
|
+
}
|
|
5
|
+
interface SpellCheckOptions {
|
|
6
|
+
DISTANCE?: number;
|
|
7
|
+
TERMS?: SpellCheckTerms | Array<SpellCheckTerms>;
|
|
8
|
+
DIALECT?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function transformArguments(index: string, query: string, options?: SpellCheckOptions): Array<string>;
|
|
11
|
+
declare type SpellCheckRawReply = Array<[
|
|
12
|
+
_: string,
|
|
13
|
+
term: string,
|
|
14
|
+
suggestions: Array<[score: string, suggestion: string]>
|
|
15
|
+
]>;
|
|
16
|
+
declare type SpellCheckReply = Array<{
|
|
17
|
+
term: string;
|
|
18
|
+
suggestions: Array<{
|
|
19
|
+
score: number;
|
|
20
|
+
suggestion: string;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function transformReply(rawReply: SpellCheckRawReply): SpellCheckReply;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = void 0;
|
|
4
|
+
function transformArguments(index, query, options) {
|
|
5
|
+
const args = ['FT.SPELLCHECK', index, query];
|
|
6
|
+
if (options?.DISTANCE) {
|
|
7
|
+
args.push('DISTANCE', options.DISTANCE.toString());
|
|
8
|
+
}
|
|
9
|
+
if (options?.TERMS) {
|
|
10
|
+
if (Array.isArray(options.TERMS)) {
|
|
11
|
+
for (const term of options.TERMS) {
|
|
12
|
+
pushTerms(args, term);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
pushTerms(args, options.TERMS);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (options?.DIALECT) {
|
|
20
|
+
args.push('DIALECT', options.DIALECT.toString());
|
|
21
|
+
}
|
|
22
|
+
return args;
|
|
23
|
+
}
|
|
24
|
+
exports.transformArguments = transformArguments;
|
|
25
|
+
function pushTerms(args, { mode, dictionary }) {
|
|
26
|
+
args.push('TERMS', mode, dictionary);
|
|
27
|
+
}
|
|
28
|
+
function transformReply(rawReply) {
|
|
29
|
+
return rawReply.map(([, term, suggestions]) => ({
|
|
30
|
+
term,
|
|
31
|
+
suggestions: suggestions.map(([score, suggestion]) => ({
|
|
32
|
+
score: Number(score),
|
|
33
|
+
suggestion
|
|
34
|
+
}))
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = void 0;
|
|
4
|
+
function transformArguments(key, string, score, options) {
|
|
5
|
+
const args = ['FT.SUGADD', key, string, score.toString()];
|
|
6
|
+
if (options?.INCR) {
|
|
7
|
+
args.push('INCR');
|
|
8
|
+
}
|
|
9
|
+
if (options?.PAYLOAD) {
|
|
10
|
+
args.push('PAYLOAD', options.PAYLOAD);
|
|
11
|
+
}
|
|
12
|
+
return args;
|
|
13
|
+
}
|
|
14
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = void 0;
|
|
4
|
+
function transformArguments(key, string) {
|
|
5
|
+
return ['FT.SUGDEL', key, string];
|
|
6
|
+
}
|
|
7
|
+
exports.transformArguments = transformArguments;
|
|
8
|
+
var generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
9
|
+
Object.defineProperty(exports, "transformReply", { enumerable: true, get: function () { return generic_transformers_1.transformBooleanReply; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const IS_READ_ONLY = true;
|
|
2
|
+
export interface SugGetOptions {
|
|
3
|
+
FUZZY?: true;
|
|
4
|
+
MAX?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function transformArguments(key: string, prefix: string, options?: SugGetOptions): Array<string>;
|
|
7
|
+
export declare function transformReply(): null | Array<string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
exports.IS_READ_ONLY = true;
|
|
5
|
+
function transformArguments(key, prefix, options) {
|
|
6
|
+
const args = ['FT.SUGGET', key, prefix];
|
|
7
|
+
if (options?.FUZZY) {
|
|
8
|
+
args.push('FUZZY');
|
|
9
|
+
}
|
|
10
|
+
if (options?.MAX) {
|
|
11
|
+
args.push('MAX', options.MAX.toString());
|
|
12
|
+
}
|
|
13
|
+
return args;
|
|
14
|
+
}
|
|
15
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SugGetOptions } from './SUGGET';
|
|
2
|
+
export { IS_READ_ONLY } from './SUGGET';
|
|
3
|
+
export declare function transformArguments(key: string, prefix: string, options?: SugGetOptions): Array<string>;
|
|
4
|
+
export interface SuggestionWithPayload {
|
|
5
|
+
suggestion: string;
|
|
6
|
+
payload: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function transformReply(rawReply: Array<string | null> | null): Array<SuggestionWithPayload> | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const SUGGET_1 = require("./SUGGET");
|
|
5
|
+
var SUGGET_2 = require("./SUGGET");
|
|
6
|
+
Object.defineProperty(exports, "IS_READ_ONLY", { enumerable: true, get: function () { return SUGGET_2.IS_READ_ONLY; } });
|
|
7
|
+
function transformArguments(key, prefix, options) {
|
|
8
|
+
return [
|
|
9
|
+
...(0, SUGGET_1.transformArguments)(key, prefix, options),
|
|
10
|
+
'WITHPAYLOADS'
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
exports.transformArguments = transformArguments;
|
|
14
|
+
function transformReply(rawReply) {
|
|
15
|
+
if (rawReply === null)
|
|
16
|
+
return null;
|
|
17
|
+
const transformedReply = [];
|
|
18
|
+
for (let i = 0; i < rawReply.length; i += 2) {
|
|
19
|
+
transformedReply.push({
|
|
20
|
+
suggestion: rawReply[i],
|
|
21
|
+
payload: rawReply[i + 1]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return transformedReply;
|
|
25
|
+
}
|
|
26
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SugGetOptions } from './SUGGET';
|
|
2
|
+
export { IS_READ_ONLY } from './SUGGET';
|
|
3
|
+
export declare function transformArguments(key: string, prefix: string, options?: SugGetOptions): Array<string>;
|
|
4
|
+
export interface SuggestionWithScores {
|
|
5
|
+
suggestion: string;
|
|
6
|
+
score: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function transformReply(rawReply: Array<string> | null): Array<SuggestionWithScores> | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const SUGGET_1 = require("./SUGGET");
|
|
5
|
+
var SUGGET_2 = require("./SUGGET");
|
|
6
|
+
Object.defineProperty(exports, "IS_READ_ONLY", { enumerable: true, get: function () { return SUGGET_2.IS_READ_ONLY; } });
|
|
7
|
+
function transformArguments(key, prefix, options) {
|
|
8
|
+
return [
|
|
9
|
+
...(0, SUGGET_1.transformArguments)(key, prefix, options),
|
|
10
|
+
'WITHSCORES'
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
exports.transformArguments = transformArguments;
|
|
14
|
+
function transformReply(rawReply) {
|
|
15
|
+
if (rawReply === null)
|
|
16
|
+
return null;
|
|
17
|
+
const transformedReply = [];
|
|
18
|
+
for (let i = 0; i < rawReply.length; i += 2) {
|
|
19
|
+
transformedReply.push({
|
|
20
|
+
suggestion: rawReply[i],
|
|
21
|
+
score: Number(rawReply[i + 1])
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return transformedReply;
|
|
25
|
+
}
|
|
26
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SugGetOptions } from './SUGGET';
|
|
2
|
+
import { SuggestionWithPayload } from './SUGGET_WITHPAYLOADS';
|
|
3
|
+
import { SuggestionWithScores } from './SUGGET_WITHSCORES';
|
|
4
|
+
export { IS_READ_ONLY } from './SUGGET';
|
|
5
|
+
export declare function transformArguments(key: string, prefix: string, options?: SugGetOptions): Array<string>;
|
|
6
|
+
declare type SuggestionWithScoresAndPayloads = SuggestionWithScores & SuggestionWithPayload;
|
|
7
|
+
export declare function transformReply(rawReply: Array<string | null> | null): Array<SuggestionWithScoresAndPayloads> | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const SUGGET_1 = require("./SUGGET");
|
|
5
|
+
var SUGGET_2 = require("./SUGGET");
|
|
6
|
+
Object.defineProperty(exports, "IS_READ_ONLY", { enumerable: true, get: function () { return SUGGET_2.IS_READ_ONLY; } });
|
|
7
|
+
function transformArguments(key, prefix, options) {
|
|
8
|
+
return [
|
|
9
|
+
...(0, SUGGET_1.transformArguments)(key, prefix, options),
|
|
10
|
+
'WITHSCORES',
|
|
11
|
+
'WITHPAYLOADS'
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
exports.transformArguments = transformArguments;
|
|
15
|
+
function transformReply(rawReply) {
|
|
16
|
+
if (rawReply === null)
|
|
17
|
+
return null;
|
|
18
|
+
const transformedReply = [];
|
|
19
|
+
for (let i = 0; i < rawReply.length; i += 3) {
|
|
20
|
+
transformedReply.push({
|
|
21
|
+
suggestion: rawReply[i],
|
|
22
|
+
score: Number(rawReply[i + 1]),
|
|
23
|
+
payload: rawReply[i + 2]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return transformedReply;
|
|
27
|
+
}
|
|
28
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
exports.IS_READ_ONLY = true;
|
|
5
|
+
function transformArguments(key) {
|
|
6
|
+
return ['FT.SUGLEN', key];
|
|
7
|
+
}
|
|
8
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
interface SynUpdateOptions {
|
|
3
|
+
SKIPINITIALSCAN?: true;
|
|
4
|
+
}
|
|
5
|
+
export declare function transformArguments(index: string, groupId: string, terms: string | Array<string>, options?: SynUpdateOptions): RedisCommandArguments;
|
|
6
|
+
export declare function transformReply(): 'OK';
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = void 0;
|
|
4
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
5
|
+
function transformArguments(index, groupId, terms, options) {
|
|
6
|
+
const args = ['FT.SYNUPDATE', index, groupId];
|
|
7
|
+
if (options?.SKIPINITIALSCAN) {
|
|
8
|
+
args.push('SKIPINITIALSCAN');
|
|
9
|
+
}
|
|
10
|
+
return (0, generic_transformers_1.pushVerdictArguments)(args, terms);
|
|
11
|
+
}
|
|
12
|
+
exports.transformArguments = transformArguments;
|