-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
FT.SEARCH: Cannot read properties of undefined (reading 'length') #2772
Comments
Hi, sorry for the late reply. We will take a look and come back to you. Regards, |
is it possible to have the raw result (i.e. a redis-cli output) so that we can see what's going on? edit: also the arguments as used to ft.search() could be useful, as the only thing I can imagine happening is that we aren't getting back results in the expected order of
if for example it's
the error would make sense, if the code expected the first response (as its now trying to parse the "next" doc-id as an array, when it isn't, but this should only happen if one specifies a RETURN option of an empty array. But I have no idea how it could get into that state, I've run through different permutations of commands and can't duplicate it, so more info is desired if possible. |
I am having the same issue, often when using "*" as a query |
if you can duplicate the query via a raw redis-cli output, it be useful. |
In the CLI it works fine |
I did some research, it might be related to this issue: redis/redis#12992 |
this makes me think its a bug in the ft.search api with a expiration/eviction race that will be really ugly to directly fix in clients due to the buggy api (though I have an idea I'll mention), and has to be fixed in the product. will forward to them. ex: ft.search does a search. it gets a number of documents ids back. so that's the first number in the array. then it returns a single doc id, and then an array of key value pairs. i'm guessing, that what it does is that it opens up the key associated with the doc-id and extract the key/value pairs then. however, what happens if that key is expired/evicted. this fails, and (my guess) is that it just goes onto to the next doc-id (though already returning this doc-id, but without any content). however, the client expect an array to be there, which its not. So if this were to be fixed in the client what would have to be done: we need to look at i/i+1 (what should be a doc-id/key-array pair) together, if i+1 isn't an array, continue loop over returned array by just incrementing 1, but not returning anything to user. If it is an array, existing code will work as expected, so increment by 2 to move to next possible pair. @leibale what do you think? |
@sjpotter I think that you/we need to talk to the search team and see whats going on.. |
ok, this is documented on ft.search page, its not the next doc-id, it is still in pairs, but it returns a null instead of an array. https://redis.io/docs/latest/commands/ft.search/
|
Description
Usage:
client.ft.search(index, query, option)
Exception:
Cannot read properties of undefined (reading 'length')
Error location: https://github.com/redis/node-redis/blob/master/packages/search/lib/commands/SEARCH.ts
while (i < tuples.length) {
The debug log shows that the reply value is
[100, [] ]
Node.js Version
v18.19.1
Redis Server Version
6.2.6
Node Redis Version
4.6.14
Platform
macOS
Logs
The text was updated successfully, but these errors were encountered: