Skip to content
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

[BUG] APPLY substr function not using -1 count as documented - [MOD-6959] #4583

Open
joeywhelan opened this issue Apr 3, 2024 · 0 comments
Assignees
Labels

Comments

@joeywhelan
Copy link

joeywhelan commented Apr 3, 2024

Per the documentation, a -1 count in the substr function is supposed to return the rest of the string from the offset.

Return the substring of s, starting at offset and having count characters.
If offset is negative, it represents the distance from the end of the string.
If count is -1, it means "the rest of the string starting at offset".

That's not what is happening. See example below. Redis Search version = 2.8.12

> FT.CREATE idx SCHEMA date TEXT SORTABLE
"OK"

> HSET key date "04-03-2024"
(integer) 1

> FT.AGGREGATE idx * APPLY 'substr(@date,6,-1)' AS Year
1) "1"
2) 1) "date"
   2) "04-03-2024"
   3) "Year"
   4) "202"
@joeywhelan joeywhelan added the bug label Apr 3, 2024
@joeywhelan joeywhelan changed the title [BUG] APPLY substr function not honoring -1 count [BUG] APPLY substr function not using -1 count as documented Apr 3, 2024
@GuyAv46 GuyAv46 changed the title [BUG] APPLY substr function not using -1 count as documented [BUG] APPLY substr function not using -1 count as documented - [MOD-6959] Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants