From 299990a1aa1137e42aceb98e461cd230412f9108 Mon Sep 17 00:00:00 2001 From: Philip Adams Date: Tue, 29 Aug 2023 16:20:45 -0700 Subject: [PATCH] handle case where metadataset != vectorset size --- AnnService/src/Core/BKT/BKTIndex.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AnnService/src/Core/BKT/BKTIndex.cpp b/AnnService/src/Core/BKT/BKTIndex.cpp index a7411f69..b77bfd60 100644 --- a/AnnService/src/Core/BKT/BKTIndex.cpp +++ b/AnnService/src/Core/BKT/BKTIndex.cpp @@ -675,11 +675,15 @@ namespace SPTAG if (p_metadataSet != nullptr) { m_pMetadata->AddBatch(*p_metadataSet); if (HasMetaMapping()) { - for (SizeType i = begin; i < end; i++) { + for (SizeType i = begin; i < end && i < begin + p_metadataSet->Count(); i++) { ByteArray meta = m_pMetadata->GetMetadata(i); std::string metastr((char*)meta.Data(), meta.Length()); UpdateMetaMapping(metastr, i); } + for (SizeType i = begin + p_metadataSet->Count(); i < end; i++) + { + m_pMetadata->Add(ByteArray::c_empty); + } } } else {