Skip to content

Commit

Permalink
Merge branch 'master' into cluster-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chayim authored Oct 26, 2022
2 parents 8748bdc + bea00b1 commit 772c716
Show file tree
Hide file tree
Showing 16 changed files with 218 additions and 420 deletions.
7 changes: 3 additions & 4 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name-template: '$NEXT_MAJOR_VERSION'
tag-template: 'v$NEXT_MAJOR_VERSION'
name-template: '$NEXT_MINOR_VERSION'
tag-template: 'v$NEXT_MINOR_VERSION'
autolabeler:
- label: 'maintenance'
files:
Expand All @@ -18,7 +18,6 @@ categories:
- title: 'Breaking Changes'
labels:
- 'breakingchange'

- title: '🧪 Experimental Features'
labels:
- 'experimental'
Expand All @@ -38,7 +37,7 @@ change-template: '- $TITLE (#$NUMBER)'
exclude-labels:
- 'skip-changelog'
template: |
## Changes
# Changes
$CHANGES
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
- uses: pypa/[email protected]
with:
inputs: requirements.txt dev_requirements.txt
ignore-vulns: |
GHSA-w596-4wvx-j9j6 # subversion related git pull, dependency for pytest. There is no impact here.
lint:
name: Code linters
Expand Down
2 changes: 1 addition & 1 deletion docs/redismodules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ These are the commands for interacting with the `RedisJSON module <https://redis
import redis
r = redis.Redis()
r.json().set("mykey", ".", {"hello": "world", "i am": ["a", "json", "object!"]}
r.json().set("mykey", ".", {"hello": "world", "i am": ["a", "json", "object!"]})
Examples of how to combine search and json can be found `here <examples/search_json_examples.html>`_.
Expand Down
4 changes: 2 additions & 2 deletions redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ async def get_connection(self, command_name, *keys, **options):
try:
if await connection.can_read_destructive():
raise ConnectionError("Connection has data") from None
except ConnectionError:
except (ConnectionError, OSError):
await connection.disconnect()
await connection.connect()
if await connection.can_read_destructive():
Expand Down Expand Up @@ -1646,7 +1646,7 @@ async def get_connection(self, command_name, *keys, **options):
try:
if await connection.can_read_destructive():
raise ConnectionError("Connection has data") from None
except ConnectionError:
except (ConnectionError, OSError):
await connection.disconnect()
await connection.connect()
if await connection.can_read_destructive():
Expand Down
8 changes: 8 additions & 0 deletions redis/commands/search/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import time
from typing import Dict, Optional, Union

from deprecated import deprecated

from redis.client import Pipeline

from ..helpers import parse_to_dict
Expand Down Expand Up @@ -236,6 +238,9 @@ def _add_document_hash(

return self.execute_command(*args)

@deprecated(
version="2.0.0", reason="deprecated since redisearch 2.0, call hset instead"
)
def add_document(
self,
doc_id,
Expand Down Expand Up @@ -289,6 +294,9 @@ def add_document(
**fields,
)

@deprecated(
version="2.0.0", reason="deprecated since redisearch 2.0, call hset instead"
)
def add_document_hash(self, doc_id, score=1.0, language=None, replace=False):
"""
Add a hash document to the index.
Expand Down
3 changes: 3 additions & 0 deletions redis/commands/search/querystring.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def __init__(self, lon, lat, radius, unit="km"):
self.radius = radius
self.unit = unit

def to_string(self):
return f"[{self.lon} {self.lat} {self.radius} {self.unit}]"


class Node:
def __init__(self, *children, **kwparams):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_asyncio/test_bloom.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ async def test_tdigest_rank(modclient: redis.Redis):
assert await modclient.tdigest().create("t-digest", 500)
assert await modclient.tdigest().add("t-digest", list(range(0, 20)))
assert -1 == (await modclient.tdigest().rank("t-digest", -1))[0]
assert 1 == (await modclient.tdigest().rank("t-digest", 0))[0]
assert 11 == (await modclient.tdigest().rank("t-digest", 10))[0]
assert [-1, 20, 10] == await modclient.tdigest().rank("t-digest", -20, 20, 9)
assert 0 == (await modclient.tdigest().rank("t-digest", 0))[0]
assert 10 == (await modclient.tdigest().rank("t-digest", 10))[0]
assert [-1, 20, 9] == await modclient.tdigest().rank("t-digest", -20, 20, 9)


@pytest.mark.redismod
Expand Down
2 changes: 1 addition & 1 deletion tests/test_asyncio/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ async def test_objlen_dollar(modclient: redis.Redis):
},
)
# Test multi
assert await modclient.json().objlen("doc1", "$..a") == [2, None, 1]
assert await modclient.json().objlen("doc1", "$..a") == [None, 2, 1]
# Test single
assert await modclient.json().objlen("doc1", "$.nested1.a") == [2]

Expand Down
Loading

0 comments on commit 772c716

Please sign in to comment.