Skip to content

FT.SEARCH RETURNS support identifier and property #2023

@dannyk03

Description

@dannyk03

From documentation of FT.SEARCH

RETURN {num} {identifier} AS {property} ... : Use this keyword to limit which attributes from the document are returned. num is the number of attributes following the keyword. If num is 0, it acts like NOCONTENT . identifier is either an attribute name (for hashes and JSON) or a JSON Path expression for (JSON). property is an optional name used in the result. If not provided, the identifier is used in the result.

However, source of node-redis has typing for RETURNS like

RETURN?: string | Array<string>;

It accepts the list of strings but we might have to provide the identifier and property for each RETURN element.
How can we provide it to redis search options since we have no typign support?

Finally, I want to query via node-redis like

FT.SEARCH" "idx:users" "*" "RETURN" "2" "$.createdBy" AS "createdBy"

Environment:

  • Node.js Version: v16
  • Redis Server Version: 6.2.6
  • Node Redis Version: 4.0.2
  • Platform: Ubuntu 20.04.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions