You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
fix FT.SEARCH
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
||||||
import { pushVerdictArgument, transformReplyTuples, TuplesObject } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
import { pushVerdictArgument, transformReplyTuples, TuplesObject } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
||||||
import { PropertyName, pushArgumentsWithLength, pushSortByArguments, SortByOptions } from '.';
|
import { PropertyName, pushArgumentsWithLength, pushSortByArguments, SortByProperty } from '.';
|
||||||
|
|
||||||
export enum AggregateSteps {
|
export enum AggregateSteps {
|
||||||
GROUPBY = 'GROUPBY',
|
GROUPBY = 'GROUPBY',
|
||||||
@@ -95,7 +95,7 @@ interface GroupByStep extends AggregateStep<AggregateSteps.GROUPBY> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface SortStep extends AggregateStep<AggregateSteps.SORTBY> {
|
interface SortStep extends AggregateStep<AggregateSteps.SORTBY> {
|
||||||
BY: SortByOptions | Array<SortByOptions>;
|
BY: SortByProperty | Array<SortByProperty>;
|
||||||
MAX?: number;
|
MAX?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
||||||
import { pushOptionalVerdictArgument, pushVerdictArgument, transformReplyTuples } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
import { pushOptionalVerdictArgument, pushVerdictArgument, transformReplyTuples } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
||||||
import { RedisSearchLanguages, PropertyName, pushSortByProperty, SortByOptions } from '.';
|
import { RedisSearchLanguages, PropertyName, pushSortByProperty, SortByProperty } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ interface SearchOptions {
|
|||||||
SCORER?: string;
|
SCORER?: string;
|
||||||
// EXPLAINSCORE?: true; // TODO: WITHSCORES
|
// EXPLAINSCORE?: true; // TODO: WITHSCORES
|
||||||
// PAYLOAD?: ;
|
// PAYLOAD?: ;
|
||||||
SORTBY?: SortByOptions;
|
SORTBY?: SortByProperty;
|
||||||
// MSORTBY?: SortByOptions | Array<SortByOptions>;
|
// MSORTBY?: SortByProperty | Array<SortByProperty>;
|
||||||
LIMIT?: {
|
LIMIT?: {
|
||||||
from: number | string;
|
from: number | string;
|
||||||
size: number | string;
|
size: number | string;
|
||||||
|
@@ -117,12 +117,12 @@ export enum RedisSearchLanguages {
|
|||||||
|
|
||||||
export type PropertyName = `${'@' | '$.'}${string}`;
|
export type PropertyName = `${'@' | '$.'}${string}`;
|
||||||
|
|
||||||
export type SortByOptions = PropertyName | {
|
export type SortByProperty = PropertyName | {
|
||||||
BY: PropertyName;
|
BY: PropertyName;
|
||||||
DIRECTION?: 'ASC' | 'DESC';
|
DIRECTION?: 'ASC' | 'DESC';
|
||||||
};
|
};
|
||||||
|
|
||||||
function pushSortByProperty(args: RedisCommandArguments, sortBy: SortByOptions): void {
|
export function pushSortByProperty(args: RedisCommandArguments, sortBy: SortByProperty): void {
|
||||||
if (typeof sortBy === 'string') {
|
if (typeof sortBy === 'string') {
|
||||||
args.push(sortBy);
|
args.push(sortBy);
|
||||||
} else {
|
} else {
|
||||||
@@ -134,7 +134,7 @@ function pushSortByProperty(args: RedisCommandArguments, sortBy: SortByOptions):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pushSortByArguments(args: RedisCommandArguments, name: string, sortBy: SortByOptions | Array<SortByOptions>): RedisCommandArguments {
|
export function pushSortByArguments(args: RedisCommandArguments, name: string, sortBy: SortByProperty | Array<SortByProperty>): RedisCommandArguments {
|
||||||
const lengthBefore = args.push(
|
const lengthBefore = args.push(
|
||||||
name,
|
name,
|
||||||
'' // will be overwritten
|
'' // will be overwritten
|
||||||
|
Reference in New Issue
Block a user