Merge branch 'redis:main' into main

This commit is contained in:
Rowan Trollope 2025-02-19 12:34:19 +09:00 committed by GitHub
commit b6d129dce0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View File

@ -1,10 +1,14 @@
This module implements vector sets for Redis, a new Redis data type similar This module implements Vector Sets for Redis, a new Redis data type similar
to sorted sets but having a vector instead of a score. It is possible to to Sorted Sets but having string elements associated to a vector instead of
add items and then get them back by similiarity to either a user-provided a score. The fundamental goal of Vector Sets is to make possible adding items,
vector or a vector of an element already inserted. and later get a subset of the added items that are the most similar to a
specified vector (often a learned embedding) of the most similar to the vector
of an element that is already part of the Vector Set.
## Installation ## Installation
Buil with:
make make
Then load the module with the following command line, or by inserting the needed directives in the `redis.conf` file. Then load the module with the following command line, or by inserting the needed directives in the `redis.conf` file.
@ -19,7 +23,7 @@ The execute the tests with:
./test.py ./test.py
## Commands ## Reference of available commands
**VADD: add items into a vector set** **VADD: add items into a vector set**

6
hnsw.c
View File

@ -648,7 +648,11 @@ pqueue *search_layer(HNSW *index, hnswNode *query, hnswNode *entry_point,
/* Stop if we can't get better results. Note that this can /* Stop if we can't get better results. Note that this can
* be true only if we already collected 'ef' elements in * be true only if we already collected 'ef' elements in
* the priority queue. */ * the priority queue. This is why: if we have less than EF
* elements, later in the for loop that checks the neighbors we
* add new elements BOTH in the results and candidates pqueue: this
* means that before accumulating EF elements, the worst candidate
* can be as bad as the worst result, but not worse. */
float furthest = pq_max_distance(results); float furthest = pq_max_distance(results);
if (cur_dist > furthest) break; if (cur_dist > furthest) break;