Closed mrkprdo closed 2 years ago
Hello, I also have the same problem with redis-om
v0.0.27.
Here is a code to reproduce the issue.
from aredis_om import JsonModel, Migrator, Field
import asyncio
class Test(JsonModel):
name: str = Field(index=True)
async def main():
await Migrator().run()
foo = Test(name="/tmp/foo/bar")
await foo.save()
results = await Test.find(Test.name == "/tmp/foo/bar").all()
# this will raise AssertionError
assert len(results) > 0
asyncio.run(main())
I checked args in execute
.
['ft.search', ':__main__.Test:index', '@name:{/tmp/foo/bar}', 'LIMIT', 0, 10]
I guess TokenEscaper
should also escape /
.
localhost:6379> ft.search :__main__.Test:index @name:{/tmp/foo/bar}
1) (integer) 0
localhost:6379> ft.search :__main__.Test:index @name:{\/tmp\/foo\/bar}
1) (integer) 1
Thanks @ninoseki @dvora-h
I have a string value which is a unix path that has slash, i can set it in db, but cannot query it. I have set
Field(index=True, full_text_search=True)
.Afaik, in sql, we can use the keyword LIKE or % escape to query it, how to do it with redis om in FindQuery?