diff --git a/README.md b/README.md index 1a1a7992d..32dfba365 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ -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 -add items and then get them back by similiarity to either a user-provided -vector or a vector of an element already inserted. +This module implements Vector Sets for Redis, a new Redis data type similar +to Sorted Sets but having string elements associated to a vector instead of +a score. The fundamental goal of Vector Sets is to make possible adding items, +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 +Buil with: + make 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 -## Commands +## Reference of available commands **VADD: add items into a vector set** diff --git a/hnsw.c b/hnsw.c index ea021c9d7..75130722f 100644 --- a/hnsw.c +++ b/hnsw.c @@ -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 * 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); if (cur_dist > furthest) break;