1
0
mirror of https://github.com/redis/node-redis.git synced 2025-12-11 09:22:35 +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 {
IS_READ_ONLY: false,
/**
*
* @experimental
*
* Conditionally removes the specified key based on value or digest comparison.
*
* @param parser - The Redis command parser

View File

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

View File

@@ -33,6 +33,9 @@ export interface SetOptions {
* Condition for setting the key:
* - `NX` - Set if key does not exist
* - `XX` - Set if key already exists
*
* @experimental
*
* - `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`)
* - `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.
*/
XX?: boolean;
GET?: boolean;
}
export default {
/**
* Constructs the SET command
*
*
* @param parser - The command parser
* @param key - The key to set
* @param value - The value to set

View File

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