Escaping backslash didn't work

  1. I tried indexing on text “login\\ today”. From my understanding, the text should be tokenized into two worlds “login\” and “today” because the escaping on the backslash itself the space will be as is and thus separate the words.
ft.create test_idx on hash prefix 1 "test:doc:" schema detail text
hset test:doc:doc1 detail "login\\\\ today" # in CLI we need to double backslash

However, when I searched for “today”, it returns nothing.

ft.search test_idx "today"

If I searched for “login\\today”, the document was retrieved.

ft.search test_idx "login\\\\today"

I’m very confused and didn’t why.

  1. I also found something else.
127.0.0.1:6379> ft.explaincli test_idx "login\\\\\\\\today"
1) UNION {
2)   login\today
3)   +login\today(expanded)
4) }
5)

I though it should have searched for “login\\today” but some of the middle backslashes are stripped.

I’m using redis_version:6.2.11 and search:2.6.7

I would appreciate if anyone can answer my questions.

Thank you so much.

Btw, if there is way to check the result of tokenization in indexing, e.g., how many or what terms are generated, that would be very helpful.