diff --git a/README.md b/README.md index 8b4d4b6875..177f78feeb 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,17 @@ The Python interface to the Redis key-value store. ## Installation -Start a redis via docker: +Start a redis via docker (for Redis versions >= 8.0): ``` bash -docker run -p 6379:6379 -it redis/redis-stack:latest +docker run -p 6379:6379 -it redis:latest ``` +Start a redis via docker (for Redis versions < 8.0): + +``` bash +docker run -p 6379:6379 -it redis/redis-stack:latest + To install redis-py, simply: ``` bash @@ -54,7 +59,7 @@ Looking for a high-level library to handle object mapping? See [redis-om-python] ## Supported Redis Versions -The most recent version of this library supports redis version [5.0](https://github.com/redis/redis/blob/5.0/00-RELEASENOTES), [6.0](https://github.com/redis/redis/blob/6.0/00-RELEASENOTES), [6.2](https://github.com/redis/redis/blob/6.2/00-RELEASENOTES), [7.0](https://github.com/redis/redis/blob/7.0/00-RELEASENOTES), [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES) and [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES). +The most recent version of this library supports Redis version [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES), [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES) and [8.0](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES). The table below highlights version compatibility of the most-recent library versions and redis versions. @@ -62,7 +67,8 @@ The table below highlights version compatibility of the most-recent library vers |-----------------|-------------------| | 3.5.3 | <= 6.2 Family of releases | | >= 4.5.0 | Version 5.0 to 7.0 | -| >= 5.0.0 | Version 5.0 to current | +| >= 5.0.0 | Version 5.0 to 7.4 | +| >= 6.0.0 | Version 7.2 to current | ## Usage @@ -152,8 +158,42 @@ The following example shows how to utilize [Redis Pub/Sub](https://redis.io/docs {'pattern': None, 'type': 'subscribe', 'channel': b'my-second-channel', 'data': 1} ``` +### Redis’ search and query capabilities default dialect + +Release 6.0.0 introduces a client-side default dialect for Redis’ search and query capabilities. +By default, the client now overrides the server-side dialect with version 2, automatically appending *DIALECT 2* to commands like *FT.AGGREGATE* and *FT.SEARCH*. --------------------------- +**Important**: Be aware that the query dialect may impact the results returned. If needed, you can revert to a different dialect version by configuring the client accordingly. + +``` python +>>> from redis.commands.search.field import TextField +>>> from redis.commands.search.query import Query +>>> from redis.commands.search.index_definition import IndexDefinition +>>> import redis + +>>> r = redis.Redis(host='localhost', port=6379, db=0) +>>> r.ft().create_index( +>>> (TextField("name"), TextField("lastname")), +>>> definition=IndexDefinition(prefix=["test:"]), +>>> ) + +>>> r.hset("test:1", "name", "James") +>>> r.hset("test:1", "lastname", "Brown") + +>>> # Query with default DIALECT 2 +>>> query = "@name: James Brown" +>>> q = Query(query) +>>> res = r.ft().search(q) + +>>> # Query with explicit DIALECT 1 +>>> query = "@name: James Brown" +>>> q = Query(query).dialect(1) +>>> res = r.ft().search(q) +``` + +You can find further details in the [query dialect documentation](https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/). + +--------------------------------------------- ### Author @@ -169,4 +209,4 @@ Special thanks to: system. - Paul Hubbard for initial packaging support. -[![Redis](./docs/_static/logo-redis.svg)](https://redis.io) +[![Redis](./docs/_static/logo-redis.svg)](https://redis.io) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 76a60398f3..bcf85df1a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,10 @@ --- +# image tag 8.0-RC2-pre is the one matching the 8.0 GA release x-client-libs-stack-image: &client-libs-stack-image - image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_STACK_IMAGE_TAG:-rs-7.4.0-v2}" + image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_STACK_IMAGE_TAG:-8.0-RC2-pre}" x-client-libs-image: &client-libs-image - image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-7.4.2}" + image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-8.0-RC2-pre}" services: diff --git a/redis/__init__.py b/redis/__init__.py index 14030205e3..cd3ee12adb 100644 --- a/redis/__init__.py +++ b/redis/__init__.py @@ -45,7 +45,7 @@ def int_or_str(value): return value -__version__ = "5.2.1" +__version__ = "6.1.0" VERSION = tuple(map(int_or_str, __version__.split(".")))