From a1847afd7e33ffd0c9b078a8e78f4181a21ead1a Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Wed, 2 Sep 2026 11:33:30 -0700 Subject: [PATCH] Declare HNSW index update must run after the node table write Index::update implementations either need the OLD value from the node table (FTS re-tokenizes the document being deleted) or the NEW value (HNSW re-scans the updated node's embedding during re-insertion, e.g. in shrinkForNode). Add updateAfterTableWrite() and return true for OnDiskHNSWIndex so NodeTable::update() runs HNSW maintenance after the row is written. Part of the fix for ladybugdb/ladybug#896. --- vector/src/include/index/hnsw_index.h | 1 + 1 file changed, 1 insertion(+) diff --git a/vector/src/include/index/hnsw_index.h b/vector/src/include/index/hnsw_index.h index a3ac95bd..858c8005 100644 --- a/vector/src/include/index/hnsw_index.h +++ b/vector/src/include/index/hnsw_index.h @@ -343,6 +343,7 @@ class OnDiskHNSWIndex final : public HNSWIndex { common::column_id_t columnID, storage::visible_func isVisible) override; void update(transaction::Transaction* transaction, const common::ValueVector& nodeIDVector, common::ValueVector& propertyVector, UpdateState& updateState) override; + bool updateAfterTableWrite() const override { return true; } static storage::IndexType getIndexType() { static const storage::IndexType HNSW_INDEX_TYPE{"HNSW",