diff --git a/contrib/usearch b/contrib/usearch index 387b78b28b1..c6329e9bfb8 160000 --- a/contrib/usearch +++ b/contrib/usearch @@ -1 +1 @@ -Subproject commit 387b78b28b17b8954024ffc81e97cbcfa10d1f30 +Subproject commit c6329e9bfb893a92c28d825cc7982580f65bbfae diff --git a/src/Storages/MergeTree/MergeTreeIndexUSearch.cpp b/src/Storages/MergeTree/MergeTreeIndexUSearch.cpp index 731aa2309e3..5f07b3be914 100644 --- a/src/Storages/MergeTree/MergeTreeIndexUSearch.cpp +++ b/src/Storages/MergeTree/MergeTreeIndexUSearch.cpp @@ -35,7 +35,7 @@ USearchIndexWithSerialization::USearchIndexWithSerialization(size_t dime } template -void USearchIndexWithSerialization::serialize([[maybe_unused]] WriteBuffer & ostr) const +void USearchIndexWithSerialization::serialize(WriteBuffer & ostr) const { auto callback = [&ostr](void * from, size_t n) { @@ -43,21 +43,20 @@ void USearchIndexWithSerialization::serialize([[maybe_unused]] WriteBuff return true; }; - Base::stream(callback); + Base::save_to_stream(callback); } template -void USearchIndexWithSerialization::deserialize([[maybe_unused]] ReadBuffer & istr) +void USearchIndexWithSerialization::deserialize(ReadBuffer & istr) { - BufferBase::Position & pos = istr.position(); - unum::usearch::memory_mapped_file_t memory_map(pos, istr.buffer().size() - istr.count()); - Base::view(std::move(memory_map)); - pos += Base::stream_length(); + auto callback = [&istr](void * from, size_t n) + { + istr.readStrict(reinterpret_cast(from), n); + return true; + }; + + Base::load_from_stream(callback); - auto copy = Base::copy(); - if (!copy) - throw Exception(ErrorCodes::LOGICAL_ERROR, "Could not copy usearch index"); - Base::swap(copy.index); } template