php-redis-client
php-redis-client copied to clipboard
Protocol issue: Syntax error at offset
Dear Alex,
Great job on the redis client! Today I was connecting to RediSearch and I think I might have found a small issue. For a case such as this one, where double quotes are used:
->executeRaw(['FT.SEARCH', 'index', '@location:"not far"'])
A following situation happens:
RedisClient\Exception\ErrorResponseException: Syntax error at offset 11 near not in ...
redis monitor is reporting a following command:
"FT.SEARCH" "index" "'@location:\"not far\"'"
However I am not sure if it's escape related, or is it just the double quote character. It is the recommended syntax: https://oss.redislabs.com/redisearch/Query_Syntax.html See "Exact phrases are wrapped in quotes, e.g "hello world"".
When running the same command directly, the syntax issue does not occur:
127.0.0.1:6379> FT.SEARCH index @location:"not far"
1) (integer) 1
2) "15cc84e0485468"
3) 1) news_id
2) "19734"
3) provider
4) "Marcin"
....
I applied a temporary workaround - single quotes instead of double quotes, which seems to work fine. Sadly I was not able to identify a place in the code, which might be the reason for this behaviour. I hope you will be able to.
Thank you! Marcin