Skip to content

Commit 13a4c6b

Browse files
committed
Merge branch 'main' into DOC-4928
2 parents f765719 + 4e1787d commit 13a4c6b

File tree

30 files changed

+594
-747
lines changed

30 files changed

+594
-747
lines changed

.github/workflows/autocomment.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ jobs:
5151
$FILES_URL \
5252
| jq -r --arg prefix $BRANCH_NAME/ '.[] | select(((.filename | test("content\/.+\\.md")) and .status != "removed")) | ($prefix + .filename)' \
5353
| sed -E -e 's|(^[^/]+/)([^/]+/)|\1|' -e 's|^|https://redis.io/docs/staging/|' -e 's|(_?index)?\.md||' \
54-
| uniq \
55-
| xargs \
56-
| sed 's/ /<br>/g')
54+
| sort \
55+
| uniq)
5756
5857
# Get all changed image files
5958
CHANGED_IMAGE_FILES=$(curl -Ls \
@@ -70,14 +69,19 @@ jobs:
7069
for CHANGED_IMAGE_FILE in $CHANGED_IMAGE_FILES; do
7170
MD_FILE_WITH_IMAGE=$(grep -ro "$CHANGED_IMAGE_FILE" content \
7271
| sed -E -e 's|:.+||' -e "s|^content/|https://redis.io/docs/staging/$BRANCH_NAME/|" -e 's|(_?index)?\.md||' \
72+
| sort \
7373
| uniq)
7474
MD_FILES_WITH_IMAGE+=($MD_FILE_WITH_IMAGE)
7575
done
76-
CHANGED_MD_FILES_WITH_IMAGE=$(printf "%s\n" "${MD_FILES_WITH_IMAGE[@]}" \
76+
CHANGED_MD_FILES=$(printf "%s\n" "${CHANGED_MD_FILES}" "${MD_FILES_WITH_IMAGE[@]}" \
77+
| sort \
7778
| uniq \
7879
| xargs \
7980
| sed 's/ /<br>/g')
80-
CHANGED_MD_FILES="${CHANGED_MD_FILES}<br>${CHANGED_MD_FILES_WITH_IMAGE}"
81+
else
82+
CHANGED_MD_FILES=$(printf "%s\n" "${CHANGED_MD_FILES}" \
83+
| xargs \
84+
| sed 's/ /<br>/g')
8185
fi
8286
8387
if [[ -z "$CHANGED_MD_FILES" ]]
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: cleanup_pr_folders
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
staging:
10+
if: github.event.pull_request.merged == true
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: 'read'
14+
id-token: 'write'
15+
env:
16+
STAGING_BUCKET: docs-staging-learn-redis-com
17+
STAGING_PROJECT_ID: ${{ secrets.GCP_PROJECT_STAGING }}
18+
STAGING_SERVICE_ACCOUNT: ${{ secrets.STAGING_SERVICE_ACCOUNT }}
19+
STAGING_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.STAGING_WORKLOAD_IDENTITY_PROVIDER }}
20+
21+
steps:
22+
- name: 'Google auth'
23+
uses: 'google-github-actions/auth@v2'
24+
with:
25+
project_id: '${{ env.STAGING_PROJECT_ID }}'
26+
service_account: '${{ env.STAGING_SERVICE_ACCOUNT }}'
27+
workload_identity_provider: '${{ env.STAGING_WORKLOAD_IDENTITY_PROVIDER }}'
28+
29+
- name: 'Set up Cloud SDK'
30+
uses: 'google-github-actions/setup-gcloud@v2'
31+
with:
32+
project_id: '${{ env.STAGING_PROJECT_ID }}'
33+
version: '>= 363.0.0'
34+
35+
- name: Remove pull request staging folder
36+
run: |
37+
BRANCH_TO_CLEANUP="${{ github.event.pull_request.head.ref }}"
38+
STAGING_BUCKET="${{ env.STAGING_BUCKET }}"
39+
40+
if gsutil -q stat gs://${STAGING_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*; then
41+
gsutil -q -m rm -r gs://${STAGING_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*
42+
echo "Removed gs://${STAGING_BUCKET}/staging/${BRANCH_TO_CLEANUP}"
43+
fi
44+
45+
prod:
46+
if: github.event.pull_request.merged == true
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: 'read'
50+
id-token: 'write'
51+
env:
52+
PROD_BUCKET: docs-prod-learn-redis-com
53+
PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }}
54+
PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }}
55+
PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }}
56+
57+
steps:
58+
- name: 'Google auth'
59+
uses: 'google-github-actions/auth@v2'
60+
with:
61+
project_id: '${{ env.PROD_PROJECT_ID }}'
62+
service_account: '${{ env.PROD_SERVICE_ACCOUNT }}'
63+
workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}'
64+
65+
- name: 'Set up Cloud SDK'
66+
uses: 'google-github-actions/setup-gcloud@v2'
67+
with:
68+
project_id: '${{ env.PROD_PROJECT_ID }}'
69+
version: '>= 363.0.0'
70+
71+
- name: Remove pull request staging folder
72+
run: |
73+
BRANCH_TO_CLEANUP="${{ github.event.pull_request.head.ref }}"
74+
PROD_BUCKET="${{ env.PROD_BUCKET }}"
75+
76+
if gsutil -q stat gs://${PROD_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*; then
77+
gsutil -q -m rm -r gs://${PROD_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*
78+
echo "Removed gs://${PROD_BUCKET}/staging/${BRANCH_TO_CLEANUP}"
79+
fi

config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rdi_redis_gears_version = "1.2.6"
5555
rdi_debezium_server_version = "2.3.0.Final"
5656
rdi_db_types = "cassandra|mysql|oracle|postgresql|sqlserver"
5757
rdi_cli_latest = "latest"
58-
rdi_current_version = "v1.6.4"
58+
rdi_current_version = "v1.6.5"
5959

6060
[params.clientsConfig]
6161
"Python"={quickstartSlug="redis-py"}

content/commands/type/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ title: TYPE
4747
---
4848
Returns the string representation of the type of the value stored at `key`.
4949
The different types that can be returned are: `string`, `list`, `set`, `zset`,
50-
`hash` and `stream`.
50+
`hash`, `stream`, and `vectorset`.
5151

5252
## Examples
5353

content/develop/clients/nodejs/transpipe.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,29 @@ const updatedPath = await client.get('shellpath');
152152
console.log(updatedPath);
153153
// >>> /usr/syscmds/:/usr/mycmds/
154154
```
155+
156+
In an environment where multiple concurrent requests are sharing a connection
157+
(such as a web server), you must wrap the above transaction logic in a call to
158+
`client.executeIsolated` to get an isolated connection, like so:
159+
160+
```js
161+
await client.executeIsolated(async (client) => {
162+
await client.watch('shellpath');
163+
// ...
164+
})
165+
```
166+
167+
This is important because the server tracks the state of the WATCH on a
168+
per-connection basis, and concurrent WATCH and MULTI/EXEC calls on the same
169+
connection will interfere with one another.
170+
171+
You can configure the size of the isolation pool when calling `createClient`:
172+
173+
```js
174+
const client = createClient({
175+
isolationPoolOptions: {
176+
min: 1,
177+
max: 100,
178+
},
179+
})
180+
```

content/develop/data-types/json/_index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ weight: 11
1919
[![Discord](https://img.shields.io/discord/697882427875393627?style=flat-square)](https://discord.gg/QUkjSsk)
2020
[![Github](https://img.shields.io/static/v1?label=&message=repository&color=5961FF&logo=github)](https://github.com/RedisJSON/RedisJSON/)
2121

22-
The JSON capability of Redis Community Edition provides JavaScript Object Notation (JSON) support for Redis. It lets you store, update, and retrieve JSON values in a Redis database, similar to any other Redis data type. Redis JSON also works seamlessly with the [Redis Query Engine]({{< relref "/develop/interact/search-and-query/" >}}) to let you [index and query JSON documents]({{< relref "/develop/interact/search-and-query/indexing/" >}}).
22+
The JSON data type provides JavaScript Object Notation (JSON) support for Redis. It lets you store, retrieve, and update JSON documents.
23+
A JSON document can be queried and manipulated using JSONPath expressions.
24+
JSON also works seamlessly with the [Redis Query Engine]({{< relref "/develop/interact/search-and-query/" >}}) to let you [index and query JSON documents]({{< relref "/develop/interact/search-and-query/indexing/" >}}).
2325

2426
## Primary features
2527

@@ -156,4 +158,4 @@ A JSON value passed to a command can have a depth of up to 128. If you pass to a
156158

157159
## Further information
158160

159-
Read the other pages in this section to learn more about Redis JSON
161+
Read the other pages in this section to learn more about Redis JSON

content/develop/data-types/vector-sets/_index.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,166 @@ The following commands are available for vector sets:
3838
- [VREM]({{< relref "/commands/vrem" >}}) - remove an element from a vector set.
3939
- [VSETATTR]({{< relref "/commands/vsetattr" >}}) - set or replace attributes on a vector set element.
4040
- [VSIM]({{< relref "/commands/vsim" >}}) - retrieve elements similar to a given vector or element with optional filtering.
41+
42+
## Examples
43+
44+
The following examples give an overview of how to use vector sets. For clarity,
45+
we will use a set of two-dimensional vectors that represent points in the
46+
Cartesian coordinate plane. However, in real use cases, the vectors will typically
47+
represent *text embeddings* and have hundreds of dimensions. See
48+
[Redis for AI]({{< relref "/develop/ai" >}}) for more information about using text
49+
embeddings.
50+
51+
The points we will use are A: (1.0, 1.0), B: (-1.0, -1.0), C: (-1.0, 1.0), D: (1.0. -1.0), and
52+
E: (1.0, 0), shown in the diagram below.
53+
54+
{{<image filename="images/vecsets/VecSetExamplePoints.drawio.svg" alt="Example points on the coordinate plane." width="400px">}}
55+
56+
### Basic operations
57+
58+
Start by adding the point vectors to a set called `points` using
59+
[`VADD`]({{< relref "/commands/vadd" >}}). This also creates the vector set object.
60+
The [`TYPE`]({{< relref "/commands/type" >}}) command returns a type of `vectorset`
61+
for this object.
62+
63+
{{< clients-example vecset_tutorial vadd >}}
64+
> VADD points VALUES 2 1.0 1.0 pt:A
65+
(integer) 1
66+
> VADD points VALUES 2 -1.0 -1.0 pt:B
67+
(integer) 1
68+
> VADD points VALUES 2 -1.0 1.0 pt:C
69+
(integer) 1
70+
> VADD points VALUES 2 1.0 -1.0 pt:D
71+
(integer) 1
72+
> VADD points VALUES 2 1.0 0 pt:E
73+
(integer) 1
74+
> TYPE points
75+
vectorset
76+
{{< /clients-example >}}
77+
78+
79+
Get the number of elements in the set (also known as the *cardinality* of the set)
80+
using [`VCARD`]({{< relref "/commands/vcard" >}}) and the number of dimensions of
81+
the vectors using [`VDIM`]({{< relref "/commands/vdim" >}}):
82+
83+
{{< clients-example vecset_tutorial vcardvdim >}}
84+
> VCARD points
85+
(integer) 5
86+
> VDIM points
87+
(integer) 2
88+
{{< /clients-example >}}
89+
90+
Get the coordinate values from the elements using [`VEMB`]({{< relref "/commands/vemb" >}}).
91+
Note that the values will not typically be the exact values you supplied when you added
92+
the vector because
93+
[quantization]({{< relref "/develop/data-types/vector-sets/performance#quantization-effects" >}})
94+
is applied to improve performance.
95+
96+
{{< clients-example vecset_tutorial vemb >}}
97+
> VEMB points pt:A
98+
1) "0.9999999403953552"
99+
2) "0.9999999403953552"
100+
9> VEMB points pt:B
101+
1) "-0.9999999403953552"
102+
2) "-0.9999999403953552"
103+
> VEMB points pt:C
104+
1) "-0.9999999403953552"
105+
2) "0.9999999403953552"
106+
> VEMB points pt:D
107+
1) "0.9999999403953552"
108+
2) "-0.9999999403953552"
109+
> VEMB points pt:E
110+
1) "1"
111+
2) "0"
112+
{{< /clients-example >}}
113+
114+
Set and retrieve an element's JSON attribute data using
115+
[`VSETATTR`]({{< relref "/commands/vsetattr" >}})
116+
and [`VGETATTR`]({{< relref "/commands/vgetattr" >}}). You can also pass an empty string
117+
to `VSETATTR` to delete the attribute data:
118+
119+
{{< clients-example vecset_tutorial attr >}}
120+
> VSETATTR points pt:A "{\"name\": \"Point A\", \"description\": \"First point added\"}"
121+
(integer) 1
122+
> VGETATTR points pt:A
123+
"{\"name\": \"Point A\", \"description\": \"First point added\"}"
124+
> VSETATTR points pt:A ""
125+
(integer) 1
126+
> VGETATTR points pt:A
127+
(nil)
128+
{{< /clients-example >}}
129+
130+
Remove an unwanted element with [`VREM`]({{< relref "/commands/vrem" >}})
131+
132+
{{< clients-example vecset_tutorial vrem >}}
133+
> VADD points VALUES 2 0 0 pt:F
134+
(integer) 1
135+
127.0.0.1:6379> VCARD points
136+
(integer) 6
137+
127.0.0.1:6379> VREM points pt:F
138+
(integer) 1
139+
127.0.0.1:6379> VCARD points
140+
(integer) 5
141+
{{< /clients-example >}}
142+
143+
### Vector similarity search
144+
145+
Use [`VSIM`]({{< relref "/commands/vsim" >}}) to rank the points in order of their vector distance from a sample point:
146+
147+
{{< clients-example vecset_tutorial vsim_basic >}}
148+
> VSIM points values 2 0.9 0.1
149+
1) "pt:E"
150+
2) "pt:A"
151+
3) "pt:D"
152+
4) "pt:C"
153+
5) "pt:B"
154+
{{< /clients-example >}}
155+
156+
Find the four elements that are closest to point A and show their distance "scores":
157+
158+
{{< clients-example vecset_tutorial vsim_options >}}
159+
> VSIM points ELE pt:A WITHSCORES COUNT 4
160+
1) "pt:A"
161+
2) "1"
162+
3) "pt:E"
163+
4) "0.8535534143447876"
164+
5) "pt:C"
165+
6) "0.5"
166+
7) "pt:D"
167+
8) "0.5"
168+
{{< /clients-example >}}
169+
170+
Add some JSON attributes and use
171+
[filter expressions]({{< relref "/develop/data-types/vector-sets/filtered-search" >}})
172+
to include them in the search:
173+
174+
{{< clients-example vecset_tutorial vsim_filter >}}
175+
> VSETATTR points pt:A "{\"size\":\"large\",\"price\": 18.99}"
176+
(integer) 1
177+
> VSETATTR points pt:B "{\"size\":\"large\",\"price\": 35.99}"
178+
(integer) 1
179+
> VSETATTR points pt:C "{\"size\":\"large\",\"price\": 25.99}"
180+
(integer) 1
181+
> VSETATTR points pt:D "{\"size\":\"small\",\"price\": 21.00}"
182+
(integer) 1
183+
> VSETATTR points pt:E "{\"size\":\"small\",\"price\": 17.75}"
184+
(integer) 1
185+
186+
# Return elements in order of distance from point A whose
187+
# `size` attribute is `large`.
188+
> VSIM points ELE pt:A FILTER '.size == "large"'
189+
1) "pt:A"
190+
2) "pt:C"
191+
3) "pt:B"
192+
193+
# Return elements in order of distance from point A whose size is
194+
# `large` and whose price is greater than 20.00.
195+
> VSIM points ELE pt:A FILTER '.size == "large" && .price > 20.00'
196+
1) "pt:C"
197+
2) "pt:B"
198+
{{< /clients-example >}}
199+
200+
## More information
201+
202+
See the other pages in this section to learn more about the features
203+
and performance parameters of vector sets.

0 commit comments

Comments
 (0)