You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LSMVectorIndex treats JVector's EUCLIDEAN return as distance — K-NN returns the worst matches first #4334
Affected version: 26.4.2 (confirmed still present in 26.5.1) Component:com.arcadedb.index.vector.LSMVectorIndex
Summary
JVector's VectorSimilarityFunction.EUCLIDEAN.compare(...) returns a similarity of the form 1/(1+L2²) (larger = closer), not a distance.
ArcadeDB stores the value as-is and sorts ascending — placing the least similar candidates first.
Code
engine/com/arcadedb/index/vector/LSMVectorIndex.java:2920–2931
(same wrong handling at :2682–2687 and :2728–2733)
EUCLIDEAN K-NN queries return wrong results whenever the delta-merge or brute-force fallback paths run (i.e. whenever the vector index has
uncommitted delta or hasn't compacted recently — the common case).
Suggested fix
- case EUCLIDEAN -> score;+ case EUCLIDEAN -> score > 0 ? (1.0f / score) - 1.0f : Float.MAX_VALUE;
Activity
docs: record PR + review history for #4334
fix(#4334): convert JVector EUCLIDEAN similarity to L2² distance in a…
docs: record PR + review history for #4334
fix(#4334): convert JVector EUCLIDEAN similarity to L2² distance in a…
test: update DeltaScanVectorSearchTest assertion after #4334 distance…
fix(ArcadeData#4334): convert JVector EUCLIDEAN similarity to L2² dis…