diff --git a/engine/src/main/java/com/arcadedb/index/vector/HnswVectorIndex.java b/engine/src/main/java/com/arcadedb/index/vector/HnswVectorIndex.java index 876619e75..bbe75e325 100644 --- a/engine/src/main/java/com/arcadedb/index/vector/HnswVectorIndex.java +++ b/engine/src/main/java/com/arcadedb/index/vector/HnswVectorIndex.java @@ -352,8 +352,10 @@ public boolean add(Vertex vertex) { if (currObj != null) { if (vertexMaxLevel < entryPointCopyMaxLevel) { final TVector vector = getVectorFromVertex(currObj); - if (vector == null) + if (vector == null) { + LogManager.instance().log(this, Level.WARNING, "Vector not found in vertex %s", currObj); throw new IndexException("Embeddings not found in object " + currObj); + } TDistance curDist = distanceFunction.distance(vertexVector, vector); for (int activeLevel = entryPointCopyMaxLevel; activeLevel > vertexMaxLevel; activeLevel--) { @@ -368,9 +370,11 @@ public boolean add(Vertex vertex) { final Vertex candidateNode = candidateConnections.next(); final TVector candidateNodeVector = getVectorFromVertex(candidateNode); - if (candidateNodeVector == null) + if (candidateNodeVector == null) { // INVALID + LogManager.instance().log(this, Level.WARNING, "Vector not found in vertex %s", candidateNode); continue; + } final TDistance candidateDistance = distanceFunction.distance(vertexVector, candidateNodeVector); @@ -512,8 +516,10 @@ public List> findNearest(final TVector destinati Vertex currObj = entryPointCopy; final TVector vector = getVectorFromVertex(currObj); - if (vector == null) + if (vector == null) { + LogManager.instance().log(this, Level.WARNING, "Vector not found in vertex %s", currObj); return Collections.emptyList(); + } TDistance curDist = distanceFunction.distance(destination, vector); @@ -598,9 +604,11 @@ private PriorityQueue> searchBaseLayer(final Vertex visitedNodes.add(candidateNode.getIdentity()); final TVector vector = getVectorFromVertex(candidateNode); - if (vector == null) + if (vector == null) { // INVALID + LogManager.instance().log(this, Level.WARNING, "Vector not found in vertex %s", candidateNode); continue; + } final TDistance candidateDistance = distanceFunction.distance(destination, vector); if (topCandidates.size() < k || gt(lowerBound, candidateDistance)) {