-
Notifications
You must be signed in to change notification settings - Fork 260
Description
Page https://redis.io/docs/latest/commands/vlinks
It states:
One of the following:
- Array reply containing the names of adjacent elements as strings; interleved with scores when using the WITHSCORES option.
- Bulk string reply (null bulk string) for unknown keys and/or elements.
I would therefore expect something like:
*2
- $... element1
- $... element2
or (when using WITHSCORES
)
*4
- $... element1
- $... 0.123
- $... element2
- $... 0.0012
However, the results are actually nested:
*2
- *0
- *2
- $... element1
- $... element2
or (when using WITHSCORES
):
*2
- *0
- *4
- $... element1
- $... 0.123
- $... element2
- $... 0.0012
I have no idea what the first empty array element represents, as it isn't documented.
Checking the implementation, it looks like it is actually
an array of arrays, where each nested array represents one level of neighbors, from highest level to level 0
where the outer dimension is "at each layer in the HNSW graph". Callers don't really interact with the HNSW graph, so it is unclear what insight (if any) we should glean from that, or how many levels we should expect, or the signficance of different levels.
Note also that RESP3 does not change this shape, but does change the types:
*2
- *0
- %4
- $... element1
- ,0.123
- $... element2
- ,0.0012
I suspect that for SE.Redis (.NET), I'm going to flatten this at the library level, i.e. pretend that [[A],[B,C],[D]]
was [A,B,C,D]
.