Repository navigation
fix(store): keep quotes and escape whitespace in store key queries - #241
Open
mohsinaliwork686-rgb wants to merge 1 commit into
Open
mohsinaliwork686-rgb wants to merge 1 commit into
mohsinaliwork686-rgb wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #237
get()built its query with redisvl'sTextandTagfilters.Textturns a double quote into a space, so the namespace no longer matched whatput()stored.Tagleaves a newline unescaped, which ends the tag value. In both casesget()returnedNonefor an item thatsearch()could find.The query now keeps the escaped namespace as it is, still as a phrase, because an unquoted
@prefix:also matches child namespaces. Keys go through a new_tag_escaper, which adds|and whitespace other than a space to the default set.The other
@key:{...}queries had the same problem, so they use it too. Onmain, with a key containing a newline or|:delete()leaves the item in place.put()keeps the old document next to the new one.Stored data doesn't change, so existing items stay readable.
Not covered:
get()andsearch()both miss those items, and none of the query forms I tried matched them.SEARCH_SYNTAX.This changes the same
deleteline as #239, so whichever merges second will need a small rebase.Tests are in
tests/test_issue_237_store_get_escaping.py: get, update and delete, sync and async, for a double quote, newline, carriage return, tab, vertical tab, form feed and|, plus a batched get and a check thatget()stays within the exact namespace. 15 of the 16 fail without the change. The namespace check passes either way.I ran these and the existing store tests against
redis:8(8.10.3) in a local container, with a smallredis_urlfixture, because I couldn't installtestcontainershere. 90 passed and 1 failed:test_async_store_setup_on_unreachable_redis_raises_connection_error, which fails the same way without this change. black and isort pass. I didn't run the rest of the test suite or mypy locally.