68 Commits

Author SHA1 Message Date
h.o.t. neglected
c5f3d3e11c Fix use-after-free in hnsw_cursor_free (#14627)
Close https://github.com/redis/redis/issues/14626.

Note that this method hasn't been used by any place.
2025-12-22 10:34:50 +08:00
debing.sun
679e009b73 Add daily CI for vectorset (#14302) 2025-12-10 08:52:43 +08:00
alonre24
42f36755ed Update RediSearch to v8.4.2 (#14542)
[8.4] Validate CLUSTER SHARDS Reply - [MOD-12432]
(b6301f5c7b)
[8.4] Fix TLS config check - [MOD-12408]
(6606e8112b)

[MOD-12432]:
https://redislabs.atlassian.net/browse/MOD-12432?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[MOD-12408]:
https://redislabs.atlassian.net/browse/MOD-12408?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2025-11-17 20:48:32 +02:00
alonre24
6d3e1fd4ac Bump Redisearch module version to v8.4.1 (#14536)
Fix FT.CREATE failure with LeanVec parameters on non-Intel
architectures(4b9dceb235)
2025-11-13 10:16:53 +02:00
alonre24
fafbf53e98 Update RediSearch version to 8.4.0 (8.4 GA) (#14530) 2025-11-12 10:30:27 +02:00
Tom Gabsow
1fddc44c61 update modules to 8.4.0 (#14519) 2025-11-10 14:39:38 +02:00
alonre24
a14ac5e731 Update RediSearch to 8.4 RC1 (v8.3.90) (#14467)
(https://github.com/RediSearch/RediSearch/pull/7076,
https://github.com/RediSearch/RediSearch/pull/6857) - Introducing
`FT.HYBRID`, a new command that enables hybrid queries combining both
text and vector search, with support for **RRF** and **LINEAR** result
combination. This update enhances performance and reliability through a
more efficient networking layer, smoother query execution, and improved
overall stability.
(https://github.com/RediSearch/RediSearch/pull/7065) - Add
`search-default-scorer` configuration to set the default text scorer
across queries (by default it is BM25).
https://github.com/RediSearch/RediSearch/pull/7022 - Handle Atomic Slot
Migration events upon moving slots from one node to another in a cluster
mode.
(https://github.com/RediSearch/RediSearch/pull/6769,
https://github.com/RediSearch/RediSearch/pull/6828,
https://github.com/RediSearch/RediSearch/pull/6877,
https://github.com/RediSearch/RediSearch/pull/6921) - Introduce query
time memory guardrails by adding a new `search-on-oom` configuration
which defines the query engine behavior when OOM (Out Of Memory) is
reached. OOM checks are applied to `FT.SEARCH`, `FT.AGGREGATE`, and
`FT.HYBRID` commands. The behavior on OOM can be configured to one of
three modes: `IGNORE`, `FAIL`, or `RETURN`.
`IGNORE` - The default behavior, run queries anyway (not recommended for
heavy queries returning a large result set).
`FAIL` - Fail query execution immediately if any of the nodes are in OOM
state when query execution starts.
`RETURN` - A best effort appraoch to return partial results when OOM is
detected in only some of the nodes in a cluster mode.
2025-10-27 11:56:03 +02:00
Tom Gabsow
815276f945 Update Json version 8.3.90 (#14453)
8.4 RC1
2025-10-27 11:54:59 +02:00
Tom Gabsow
0286257e59 Update RedisBloom module version to v8.3.90 (#14454) 2025-10-27 11:54:35 +02:00
Tom Gabsow
efb2aa2cb2 Update time series version to v8.3.90 (#14468) 2025-10-27 11:54:13 +02:00
Mincho Paskalev
414758dd98 Guard calls to vectorDistanceFloat SIMD calls behind ifdefs (#14458) 2025-10-25 15:32:35 +03:00
Martin Dimitrov
976041cbeb Vectorize vectors_distance_float in vector-sets (#14222)
Conducted tests on IceLake server with LAION 512 1M vectors dataset. We
can see in the perf profile, that function ‘vector_distance_float’ is
consuming majority of the computation time (this profile is captured
during upload). Vectorizing this function, leads to about 2.38X speedup
in upload time and 1.45X speedup in RPS during search.

---------

Co-authored-by: debing.sun <debing.sun@redis.com>
Co-authored-by: Omer Shadmi <76992134+oshadmi@users.noreply.github.com>
2025-10-24 12:46:18 +08:00
Salvatore Sanfilippo
3de2fdad58 [vector sets] VRANGE implementation (#14235)
This is basically the Vector Set iteration primitive.
It exploits the underlying radix tree implementation.
The usage pattern is strongly reminiscent of other Redis commands doing
similar things.

The command usage is straightforward:

```
> VRANGE word_embeddings_int8 [Redis + 10
 1) "Redis"
 2) "Rediscover"
 3) "Rediscover_Ashland"
 4) "Rediscover_Northern_Ireland"
 5) "Rediscovered"
 6) "Rediscovered_Bookshop"
 7) "Rediscovering"
 8) "Rediscovering_God"
 9) "Rediscovering_Lost"
10) "Rediscovers"
```

The above command returns 10 (or less, if less are available in the
specified range) elements from "Redis" (inclusive) to the maximum
possible element. The comparison is performed byte by byte, as
`memcmp()` would do, in this way the elements have a total order. The
start and end range can be either a string, prefixed
by `[` or `(` (the prefix is mandatory) to tell the command if the range
is inclusive or exclusive, or can be the special symbols `-` and `+`
that means the maximum and minimum element.

More info can be found in the implementation itself and in the README
file change.

---------

Co-authored-by: debing.sun <debing.sun@redis.com>
2025-10-09 10:14:14 +08:00
Joan Fontanals
97df5b5411 [RED-170693] Limit efSearch parameter to avoid heap overflow (#14373)
This PR aims to avoid the situation of a potential crash when efSearch
is too large (and therefore the memory allocated could lead to a server
crash or an integer overflow (where less memory is allocated than
expected).

- Limit the accepted EF in the request o 100_000 as in VADD
- Limit the ef search to the number of nodes in the HNSW graph
2025-10-05 16:15:24 +08:00
Tom Gabsow
161130f412 Update json version 8.3.80 (#14399) 2025-09-30 20:06:17 +03:00
Tom Gabsow
2cd4afb39a Update bloom v8.3.80 (#14398) 2025-09-30 20:05:40 +03:00
Tom Gabsow
77c995dcbd Update time series v8.3.80 (#14397) 2025-09-30 20:05:04 +03:00
Rushabh Mehta
e8726d18e5 [vector sets] Add --ollama-url option to configure embedding server (#14317)
This PR adds a `--ollama-url` option to `cli.py`, the lightweight
redis-cli-like tool that expands !"text" arguments into embeddings via
Ollama.

Previously, the embedding call was hardcoded to
http://localhost:11434/api/embeddings. With this change, users can
specify a custom Ollama server URL when starting the tool.

If no URL is provided, the tool defaults to what it was before.
2025-09-15 09:33:18 +08:00
h.o.t. neglected
64f63bfcb0 Fix help docs of vector-set commands (#14192)
Fix https://github.com/redis/redis/issues/14026
Use `RedisModule_SetCommandInfo` to add help info for vector-set
commands.
2025-09-11 11:49:42 +08:00
Vitah Lin
38d16a82eb Fix missing prev update in hnsw_cursor_free causing unlink failure (#14050)
This PR fixes a bug in the `hnsw_cursor_free` function where the prev
pointer was never updated during cursor list traversal. As a result, if
the cursor being freed was not the head of the list, it would not be
correctly unlinked, potentially causing memory leaks or corruption of
the cursor list.

Note that since `hnsw_cursor_free()` is never used for now, this PR does
not actually fix any bug.
2025-08-28 21:17:55 +08:00
alonre24
b99ca67ec3 RediSearch v8.2.1 (#14269)
* Protect cursors that are running in the background for FT.AGGREGATE
command while running FLUSHDB and avoid server crash -
https://github.com/RediSearch/RediSearch/pull/6601
* Fix performance regression in `info` command upon computing search
indexes memory due to a change in Trie data structure implementation,
and having it in O(1) again -
https://github.com/RediSearch/RediSearch/pull/6621
2025-08-13 22:26:02 +03:00
Salvatore Sanfilippo
674b829981 VSIM EPSILON fixes (#14223)
Hi, this PR implements the following changes:

1. The EPSILON option of VSIM is now documented.
2. The EPSILON behavior was fixed: the score was incorrectly divided by
two in the meaning, with a 0-2 interval provided by the underlying
cosine similarity, instead of the 0-1 interval. So an EPSILON of 0.2
only returned elements with a distance between 1 and 0.9 instead of 1
and 0.8. This is a *breaking change* but the command was not documented
so far, and it is a fix, as the user sees the similarity score so was a
total mismatch. I believe this fix should definitely be back ported as
soon as possible.
3. There are now tests.

Thanks for checking,
Salvatore
2025-08-12 11:45:35 +08:00
Eran Hadad
c636d80a77 Update Bloom, Json, and Timeserise to 8.2.0 (#14230) 2025-07-31 12:00:44 +03:00
alonre24
96ff42b20e Bump RediSearch to 8.2.0 (#14232)
* Expose more compression variants for the new SVS-VAMANA vector index -
https://github.com/RediSearch/RediSearch/pull/6430
* Add the optional `SHARD_K_RATIO` parameter for KNN vector query in a
cluster environment to favor network latency reduction at the expense of
accuracy (under unsatble features) -
https://github.com/RediSearch/RediSearch/pull/6531,
https://github.com/RediSearch/RediSearch/pull/6535
2025-07-31 11:55:31 +03:00
Salvatore Sanfilippo
b528788f65 Fix vrand ping pong (#14183)
VRANDMEMBER had a bug when exactly two elements where present in the
vector set: we selected a fixed number of random paths to take, and this
will lead always to the same element. This PR should be kindly
back-ported to Redis 8.x.
2025-07-18 18:19:14 +08:00
Ali-Akber Saifee
d86cf66101 Move WITHATTRIBS token from vlinks to vsim (#14194)
# Description
The `WITHATTRIBS` token was incorrectly documented under the `vlinks`
command in #14065
2025-07-16 20:17:53 +08:00
Salvatore Sanfilippo
b5d54866ac [Vector sets] Endianess fix and speedup of data loading (#14144)
Hello, this is a patch that improves vector sets in two ways:

1. It makes the RDB format compatible with big endian machines: yeah,
they are non existent nowadays, but still it is better to be correct.
The behavior remains unchanged in little endian systems, it only changes
what happens in big endian systems in order for it to load and emit the
exact same format produced by little endian. The implementation was
*already largely safe* but for one detail.

2. More importantly, this PR saves nodes worst link score / index in a
backward compatible way, introducing also versioning information for the
serialized node encoding, that could be useful in the future. With this
information, that in the past was not saved for a programming error
(mine), there is no longer need to compute the worst link info at
runtime when loading data. This results in a speed improvement of about
30% when loading data from disk / RESTORE. The saving performance is
unaffected.

The patch was tested with care to be sure that data produced with old
vector sets implementations are loaded without issues (that is, the
backward compatibility was hand-tested). The new code is tested by the
persistence test already in the test suite, so no new test was added.
2025-07-10 10:08:59 +08:00
Ali-Akber Saifee
92e39cac96 Fix version for vector set commands.json (#14005)
# Description 

Update `since` for all vector set commands from `1.0.0` to `8.0.0`
2025-07-08 16:32:00 +08:00
adamiBs
9ff8ade64a Fix incorrect Rust 1.88.0 SHA256 checksums in modules/Makefile (#14176)
The SHA256 checksums for Rust 1.88.0 were incorrect, causing checksum
verification failures during installation. Updated with the correct
official checksums from https://static.rust-lang.org/dist/:

- x86_64-unknown-linux-gnu:
7b5437c1d18a174faae253a18eac22c32288dccfc09ff78d5ee99b7467e21bca
- x86_64-unknown-linux-musl:
200bcf3b5d574caededba78c9ea9d27e7afc5c6df4154ed0551879859be328e1
- aarch64-unknown-linux-gnu:
d5decc46123eb888f809f2ee3b118d13586a37ffad38afaefe56aa7139481d34
- aarch64-unknown-linux-musl:
f8b3a158f9e5e8cc82e4d92500dd2738ac7d8b5e66e0f18330408856235dec35
2025-07-06 22:04:50 +03:00
Jonas Kruckenberg
17ffb1ab80 chore: Rust version bump to 1.88 (#14167)
Simple version bump from Rust 1.87 to Rust 1.88 to make nightly build
again.
2025-07-06 14:44:40 +03:00
Eran Hadad
a7d91145c0 Update Bloom, TS, and JSON Modules to Version 8.1.90 (#14160) 2025-07-02 22:13:39 +03:00
alonre24
2826fc834a Update redisearch to 8.2 RC1 (#14159)
[#Q6329](https://github.com/RediSearch/RediSearch/pull/6329),
[#Q6329](https://github.com/RediSearch/RediSearch/pull/6394) -
Introducing the new SVS-VAMANA vector index type which supports vector
compression (optimized on Intel machines)
2025-07-02 22:10:42 +03:00
Salvatore Sanfilippo
8948a5d2b2 [Vector Sets] IN operator for string/string operands (#14122)
This PR introduces "IN" overloading for strings in Vector Sets VSIM
FILTER expressions.
Now it is possible to do something like:

    "foo" IN "foobar"

IN continues to work as usually if the second operand is an array,
checking for membership of the left operand.

Ping @rowantrollope that requested this feature. I'm evaluating if to
add glob matching functionalities via the `=~` operator but I need to do
an optimization round in our glob matching function probably. Glob
matching can be slower, at the same time the complexity of the greedy
search in the graph remains unchanged, so it may be a good idea to have
it.

Case insensitive search will be likely not be added however, since this
would require handling unicode that is kinda outside the scope of Redis
filters. The user is still able to perform `"foo" in "foobar" || "FOO"
in "foobar"` at least.
2025-06-26 10:13:54 +08:00
Salvatore Sanfilippo
f6d1fd08f9 Vset tests improvements (#14089)
This changes improve a bit the Vector Sets tests:

* DB9 is used instead of the target DB. After a successful test the DB
is left empty.
* If the replica is not available, the replication tests are skipped
without errors but just a warning.
* Other refactoring stuff.
2025-06-18 10:23:22 +08:00
lerman25
a8cde7d19c Fix alpine missing __STRING #define (#14133)
Alpine Linux doesn't provide the  __STRING macro, causing build failure:
Adding conditional define the macro if not already available.
2025-06-17 21:50:35 +08:00
lerman25
94aebb7324 Add config base to vector-sets and hnsw thread config (#14082)
This PR introduces the initial configuration infrastructure for
vector-sets, along with a new option:
`vset-force-single-threaded-execution`. When enabled, it applies the
`NOTHREAD` flag to VSIM and disables the `CAS` option for VADD, thereby
enforcing single-threaded execution.
Note: This mode is not optimized for single-threaded performance.

---------

Co-authored-by: GuyAv46 <47632673+GuyAv46@users.noreply.github.com>
Co-authored-by: debing.sun <debing.sun@redis.com>
2025-06-16 10:06:43 +08:00
Alexander Dobrzhansky
b1d202fb23 Bump rust version for INSTALL_RUST_TOOLCHAIN flag (#14118)
Updates the rust version that is getting installed if
`INSTALL_RUST_TOOLCHAIN` is defined
2025-06-12 11:50:24 +03:00
Salvatore Sanfilippo
27dd3b71ce Vector Sets fixes against corrupted data in absence of checksum verification (#14102)
Vector Sets deserialization was not designed to resist corrupted data,
assuming that a good checksum would mean everything is fine. However
Redis allows the user to specify extra protection via a specific
configuration option.

This commit makes the implementation more resistant, at the cost of some
slowdown. This also fixes a serialization bug that is unrelated (and has
no memory corruption effects) about the lack of the worst index /
distance serialization, that could lower the quality of a graph after
links are replaced. I'll address the serialization issues in a new PR
that will focus on that aspect alone (already work in progress).

The net result is that loading vector sets is, when the serialization of
worst index/distance is missing (always, for now) 100% slower, that is 2
times the loading time we had before. Instead when the info will be
added it will be just 10/15% slower, that is, just making the new sanity
checks.

It may be worth to export to modules if advanced sanity check if needed
or not. Anyway most of the slowdown in this patch comes from having to
recompute the worst neighbor, since duplicated and non reciprocal links
detection was heavy optimized with probabilistic algorithms.

---------

Co-authored-by: debing.sun <debing.sun@redis.com>
2025-06-10 21:55:09 +08:00
alonre24
2ba81b7095 Bump search version to 8.1.00 (#14110) 2025-06-08 16:24:52 +03:00
Eran Hadad
38a8894b50 Update TS, JSON and Bloom Modules to 8.1.00 (#14109) 2025-06-08 16:24:19 +03:00
Salvatore Sanfilippo
0ac822e154 Implement WITHATTRIBS for VSIM. (#14065)
Hi, as described, this implements WITHATTRIBS, a feature requested by a
few users, and indeed needed.
This was requested the first time by @rowantrollope but I was not sure
how to make it work with RESP2 and RESP3 in a clean way, hopefully
that's it.

The patch includes tests and documentation updates.
2025-05-27 22:12:48 +08:00
Salvatore Sanfilippo
65e164caff [Vector sets] More rdb loading fixes (#14032)
Hi all, this PR fixes two things:

1. An assertion, that prevented the RDB loading from recovery if there
was a quantization type mismatch (with regression test).
2. Two code paths that just returned NULL without proper cleanup during
RDB loading.
2025-05-12 21:57:38 +03:00
Salvatore Sanfilippo
a46624e10e [Vector sets] RDB IO errors handling (#13978)
This PR adds support for REDISMODULE_OPTIONS_HANDLE_IO_ERRORS.
and tests for short read and corrupted RESTORE payload.

Please: note that I also removed the comment about async loading support
since we should be already covered. No manipulation of global data
structures in Vector Sets, if not for the unique ID used to create new
vector sets with different IDs.
2025-05-07 21:49:00 +03:00
Eran Hadad
a3f1d09a7d Update TS, JSON and Bloom to 8.0.1 (#14013) 2025-05-06 21:20:29 +03:00
alonre24
14578b3b8b RQE - bump version to 8.0.1 (#14011) 2025-05-06 21:19:43 +03:00
Eran Hadad
c37a782153 Update Bloom TS and JSON to 8.0.0 (#13999) 2025-05-05 21:39:19 +03:00
Salvatore Sanfilippo
11947d8892 [Vector sets] fast JSON filter (#13959)
This PR replaces cJSON with an home-made parser designed for the kind of
access pattern the FILTER option of VSIM performs on JSON objects. The
main points here are:

* cJSON forces us to parse the whole JSON, create a graph of cJSON
objects, then we need to seek in O(N) to find the right field.
* The cJSON object associated with the value is not of the same format
as the expr.c virtual machine. We needed a conversion function doing
more allocation and work.
* Right now we only support top level fields in the JSON object, so a
full parser is not needed.

With all these things in mind, and after carefully profiling the old
code, I realized that a specialized parser able to parse JSON in a
zero-allocation fashion and only actually parse the value associated to
our key would be much more efficient. Moreover, after this change, the
dependencies of Vector Sets to external code drops to zero, and the
count of lines of code is 3000 lines less. The new line count with LOC
is 4200, making Vector Sets easily the smallest full featured
implementation of a Vector store available.

# Speedup achieved

In a dataset with JSON objects with 30 fields, 1 million elements, the
following query shows a 3.5x speedup:

vsim vectors:million ele ele943903 FILTER ".field29 > 1000 and .field15
< 50"
     
Please note that we get **3.5x speedup** in the VSIM command itself.
This means that the actual JSON parsing speedup is significantly greater
than that. However, in Redis land, under my past kingdom of many years
ago, the rule was that an improvement would produce speedups that are
*user facing*. This PR definitely qualifies.

What is interesting is that even with a JSON containing a single element
the speedup is of about 70%, so we are faster even in the worst case.

# Further info

Note that the new skipping parser, may happily process JSON objects that
are not perfectly valid, as soon as they look valid from the POV of
balancing [] and {} and so forth. This should not be an issue. Anyway
invalid JSON produces random results (the element is skipped at all even
if it would pass the filter).

Please feel free to ask me anything about the new implementation before
merging.
2025-05-05 09:52:42 +03:00
DvirDukhan
6ec78b4742 Update Makefile - RQE 8.0.0 (#14002) 2025-05-02 11:59:19 +03:00
Pieter Cailliau
d65102861f Adding AGPLv3 as a license option to Redis! (#13997)
Read more about [the new license option](http://redis.io/blog/agplv3/)
and [the Redis 8 release](http://redis.io/blog/redis-8-ga/).
2025-05-01 14:04:22 +01:00
DvirDukhan
d7e0d03b11 Update Makefile - search & TS RC2 (#13985) 2025-04-27 22:47:48 +03:00