Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/client/lib/commands/DELEX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions packages/client/lib/commands/DIGEST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions packages/client/lib/commands/SET.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand All @@ -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
Expand Down
37 changes: 19 additions & 18 deletions packages/search/lib/commands/HYBRID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
Expand All @@ -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:
Expand All @@ -300,7 +301,7 @@ export default {
// This is a cursor reply
const [searchResults, cursor] = reply;
const transformedResults = transformHybridSearchResults(searchResults);

return {
...transformedResults,
cursor
Expand Down Expand Up @@ -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));
Expand Down
Loading