Skip to content

fix(search): adjust field types for ft.search #3018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nkaradzhov
Copy link
Collaborator

In ft.search SORTBY, SUMMARIZE and HIGHLIGHT all take string arguments and do not need @ or $ as a prefix. In fact, if you put @ or $ there, redis returns error like this:

[SimpleError: Property @age not loaded nor in schema]

fixes #3017

In ft.search SORTBY, SUMMARIZE and HIGHLIGHT all take
string arguments and do not need @ or $ as a prefix.
In fact, if you put @ or $ there, redis returns error like this:

[SimpleError: Property `@age` not loaded nor in schema]

fixes redis#3017
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the SEARCH command interface to use plain string (or other RedisArgument) values instead of schema-bound RediSearchProperty for SORTBY, SUMMARIZE, and HIGHLIGHT options. It removes the now-unused RediSearchProperty import and adjusts the types accordingly.

  • Swapped RediSearchProperty with RedisArgument for SUMMARIZE.FIELDS, HIGHLIGHT.FIELDS, and SORTBY.BY
  • Removed the RediSearchProperty import from the module
Comments suppressed due to low confidence (3)

packages/search/lib/commands/SEARCH.ts:35

  • Add or update tests to cover the new string-only FIELDS option in SUMMARIZE to ensure it serializes correctly in the command builder.
    FIELDS?: RedisArgument | Array<RedisArgument>;

packages/search/lib/commands/SEARCH.ts:41

  • Add or update tests to cover the new string-only FIELDS option in HIGHLIGHT to ensure it serializes correctly in the command builder.
    FIELDS?: RedisArgument | Array<RedisArgument>;

packages/search/lib/commands/SEARCH.ts:54

  • Add or update tests to cover the new string-only BY option in SORTBY to ensure it serializes correctly in the command builder.
    BY: RedisArgument;

Copy link
Member

@bobymicroby bobymicroby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript search SORTBY BY option results in error
2 participants