1
0
mirror of https://github.com/redis/node-redis.git synced 2025-12-12 21:21:15 +03:00

chore: mark 8.4 features as experimental (#3134)

This commit is contained in:
Nikolay Karadzhov
2025-11-11 13:03:19 +02:00
committed by GitHub
parent f8841c880e
commit c9f8cbcad5
4 changed files with 30 additions and 20 deletions

View File

@@ -25,6 +25,9 @@ type DelexCondition = (typeof DelexCondition)[keyof typeof DelexCondition];
export default { export default {
IS_READ_ONLY: false, IS_READ_ONLY: false,
/** /**
*
* @experimental
*
* Conditionally removes the specified key based on value or digest comparison. * Conditionally removes the specified key based on value or digest comparison.
* *
* @param parser - The Redis command parser * @param parser - The Redis command parser

View File

@@ -4,6 +4,9 @@ import { Command, RedisArgument, SimpleStringReply } from "../RESP/types";
export default { export default {
IS_READ_ONLY: true, IS_READ_ONLY: true,
/** /**
*
* @experimental
*
* Returns the XXH3 hash of a string value. * Returns the XXH3 hash of a string value.
* *
* @param parser - The Redis command parser * @param parser - The Redis command parser

View File

@@ -33,6 +33,9 @@ export interface SetOptions {
* Condition for setting the key: * Condition for setting the key:
* - `NX` - Set if key does not exist * - `NX` - Set if key does not exist
* - `XX` - Set if key already exists * - `XX` - Set if key already exists
*
* @experimental
*
* - `IFEQ` - Set if current value equals match-value (since 8.4, requires `matchValue`) * - `IFEQ` - Set if current value equals match-value (since 8.4, requires `matchValue`)
* - `IFNE` - Set if current value does not equal match-value (since 8.4, requires `matchValue`) * - `IFNE` - Set if current value does not equal match-value (since 8.4, requires `matchValue`)
* - `IFDEQ` - Set if current value digest equals match-digest (since 8.4, requires `matchValue`) * - `IFDEQ` - Set if current value digest equals match-digest (since 8.4, requires `matchValue`)
@@ -53,14 +56,14 @@ export interface SetOptions {
* @deprecated Use `{ condition: 'XX' }` instead. * @deprecated Use `{ condition: 'XX' }` instead.
*/ */
XX?: boolean; XX?: boolean;
GET?: boolean; GET?: boolean;
} }
export default { export default {
/** /**
* Constructs the SET command * Constructs the SET command
* *
* @param parser - The command parser * @param parser - The command parser
* @param key - The key to set * @param key - The key to set
* @param value - The value to set * @param value - The value to set

View File

@@ -116,11 +116,11 @@ function parseVectorExpression(parser: CommandParser, vsim: FtHybridVectorExpres
if (vsim.method.KNN) { if (vsim.method.KNN) {
const knn = vsim.method.KNN; const knn = vsim.method.KNN;
parser.push('KNN', '1', 'K', knn.K.toString()); parser.push('KNN', '1', 'K', knn.K.toString());
if (knn.EF_RUNTIME !== undefined) { if (knn.EF_RUNTIME !== undefined) {
parser.push('EF_RUNTIME', knn.EF_RUNTIME.toString()); parser.push('EF_RUNTIME', knn.EF_RUNTIME.toString());
} }
if (knn.YIELD_DISTANCE_AS) { if (knn.YIELD_DISTANCE_AS) {
parser.push('YIELD_DISTANCE_AS', knn.YIELD_DISTANCE_AS); parser.push('YIELD_DISTANCE_AS', knn.YIELD_DISTANCE_AS);
} }
@@ -129,11 +129,11 @@ function parseVectorExpression(parser: CommandParser, vsim: FtHybridVectorExpres
if (vsim.method.RANGE) { if (vsim.method.RANGE) {
const range = vsim.method.RANGE; const range = vsim.method.RANGE;
parser.push('RANGE', '1', 'RADIUS', range.RADIUS.toString()); parser.push('RANGE', '1', 'RADIUS', range.RADIUS.toString());
if (range.EPSILON !== undefined) { if (range.EPSILON !== undefined) {
parser.push('EPSILON', range.EPSILON.toString()); parser.push('EPSILON', range.EPSILON.toString());
} }
if (range.YIELD_DISTANCE_AS) { if (range.YIELD_DISTANCE_AS) {
parser.push('YIELD_DISTANCE_AS', range.YIELD_DISTANCE_AS); parser.push('YIELD_DISTANCE_AS', range.YIELD_DISTANCE_AS);
} }
@@ -142,10 +142,10 @@ function parseVectorExpression(parser: CommandParser, vsim: FtHybridVectorExpres
if (vsim.FILTER) { if (vsim.FILTER) {
parser.push('FILTER', vsim.FILTER.expression); parser.push('FILTER', vsim.FILTER.expression);
if (vsim.FILTER.POLICY) { if (vsim.FILTER.POLICY) {
parser.push('POLICY', vsim.FILTER.POLICY); parser.push('POLICY', vsim.FILTER.POLICY);
if (vsim.FILTER.POLICY === 'BATCHES' && vsim.FILTER.BATCHES) { if (vsim.FILTER.POLICY === 'BATCHES' && vsim.FILTER.BATCHES) {
parser.push('BATCHES', 'BATCH_SIZE', vsim.FILTER.BATCHES.BATCH_SIZE.toString()); parser.push('BATCHES', 'BATCH_SIZE', vsim.FILTER.BATCHES.BATCH_SIZE.toString());
} }
@@ -165,11 +165,11 @@ function parseCombineMethod(parser: CommandParser, combine: FtHybridOptions['COM
if (combine.method.RRF) { if (combine.method.RRF) {
const rrf = combine.method.RRF; const rrf = combine.method.RRF;
parser.push('RRF', rrf.count.toString()); parser.push('RRF', rrf.count.toString());
if (rrf.WINDOW !== undefined) { if (rrf.WINDOW !== undefined) {
parser.push('WINDOW', rrf.WINDOW.toString()); parser.push('WINDOW', rrf.WINDOW.toString());
} }
if (rrf.CONSTANT !== undefined) { if (rrf.CONSTANT !== undefined) {
parser.push('CONSTANT', rrf.CONSTANT.toString()); parser.push('CONSTANT', rrf.CONSTANT.toString());
} }
@@ -178,11 +178,11 @@ function parseCombineMethod(parser: CommandParser, combine: FtHybridOptions['COM
if (combine.method.LINEAR) { if (combine.method.LINEAR) {
const linear = combine.method.LINEAR; const linear = combine.method.LINEAR;
parser.push('LINEAR', linear.count.toString()); parser.push('LINEAR', linear.count.toString());
if (linear.ALPHA !== undefined) { if (linear.ALPHA !== undefined) {
parser.push('ALPHA', linear.ALPHA.toString()); parser.push('ALPHA', linear.ALPHA.toString());
} }
if (linear.BETA !== undefined) { if (linear.BETA !== undefined) {
parser.push('BETA', linear.BETA.toString()); parser.push('BETA', linear.BETA.toString());
} }
@@ -216,7 +216,7 @@ function parseHybridOptions(parser: CommandParser, options?: FtHybridOptions) {
if (options.GROUPBY) { if (options.GROUPBY) {
parseOptionalVariadicArgument(parser, 'GROUPBY', options.GROUPBY.fields); parseOptionalVariadicArgument(parser, 'GROUPBY', options.GROUPBY.fields);
if (options.GROUPBY.REDUCE) { if (options.GROUPBY.REDUCE) {
parser.push('REDUCE', options.GROUPBY.REDUCE.function, options.GROUPBY.REDUCE.count.toString()); parser.push('REDUCE', options.GROUPBY.REDUCE.function, options.GROUPBY.REDUCE.count.toString());
parser.push(...options.GROUPBY.REDUCE.args); parser.push(...options.GROUPBY.REDUCE.args);
@@ -257,11 +257,11 @@ function parseHybridOptions(parser: CommandParser, options?: FtHybridOptions) {
if (options.WITHCURSOR) { if (options.WITHCURSOR) {
parser.push('WITHCURSOR'); parser.push('WITHCURSOR');
if (options.WITHCURSOR.COUNT !== undefined) { if (options.WITHCURSOR.COUNT !== undefined) {
parser.push('COUNT', options.WITHCURSOR.COUNT.toString()); parser.push('COUNT', options.WITHCURSOR.COUNT.toString());
} }
if (options.WITHCURSOR.MAXIDLE !== undefined) { if (options.WITHCURSOR.MAXIDLE !== undefined) {
parser.push('MAXIDLE', options.WITHCURSOR.MAXIDLE.toString()); parser.push('MAXIDLE', options.WITHCURSOR.MAXIDLE.toString());
} }
@@ -274,10 +274,11 @@ export default {
/** /**
* Performs a hybrid search combining multiple search expressions. * Performs a hybrid search combining multiple search expressions.
* Supports multiple SEARCH and VECTOR expressions with various fusion methods. * Supports multiple SEARCH and VECTOR expressions with various fusion methods.
* *
* @experimental
* NOTE: FT.Hybrid is still in experimental state * NOTE: FT.Hybrid is still in experimental state
* It's behavioud and function signature may change` * It's behaviour and function signature may change
* *
* @param parser - The command parser * @param parser - The command parser
* @param index - The index name to search * @param index - The index name to search
* @param options - Hybrid search options including: * @param options - Hybrid search options including:
@@ -300,7 +301,7 @@ export default {
// This is a cursor reply // This is a cursor reply
const [searchResults, cursor] = reply; const [searchResults, cursor] = reply;
const transformedResults = transformHybridSearchResults(searchResults); const transformedResults = transformHybridSearchResults(searchResults);
return { return {
...transformedResults, ...transformedResults,
cursor cursor
@@ -345,7 +346,7 @@ function documentValue(tuples: any) {
while (i < tuples.length) { while (i < tuples.length) {
const key = tuples[i++]; const key = tuples[i++];
const value = tuples[i++]; const value = tuples[i++];
if (key === '$') { // might be a JSON reply if (key === '$') { // might be a JSON reply
try { try {
Object.assign(message, JSON.parse(value)); Object.assign(message, JSON.parse(value));