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

arrindex returns -1 when finding the last value in the array (and when start and stop are not specified) #2481

Closed
ajavia opened this issue Dec 2, 2022 · 2 comments · Fixed by #2611

Comments

@ajavia
Copy link

ajavia commented Dec 2, 2022

Version: redis-py 4.1.4, redis 6.2.7

Platform: Python 3.10.5 on MacOS 12.6.1

Description: When using arrindex, the behavior for finding the last element of the array, and finding no element in the array is the same when default start and stop are unspecified.

For example, I have an array ['test', 'test2' and 'test3']

When executing

redis_client.json().arrindex(f'type:key','arr_name','test3')

redis_client.json().arrindex(f'type:key','arr_name','test4')

The response is the same [-1].

It works fine when I search

redis_client.json().arrindex(f'type:key','arr_name','test3',start=0, stop=1000000)
@aksinha334
Copy link
Contributor

Hi @chayim @uglide , do we have any PR for this? If not can I take this up and continue to analyze from my side.

@davemcphee
Copy link
Contributor

@aksinha334 This was impacting us as well, PR created :: [ https://github.com//pull/2611 ]

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

Successfully merging a pull request may close this issue.

6 participants