From 6b09e9970919abbdebd25fbb3295c5b5d6bbe5a6 Mon Sep 17 00:00:00 2001 From: Octavian Guzu Date: Mon, 4 Aug 2025 03:09:34 -0700 Subject: [PATCH] Bug fix for faiss_Index_sa_code_size (#4492) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4492 The C api has a bug where we don't set the size in this method. The CPP api sets it correctly https://www.internalfb.com/code/fbsource/[630a7e128132fa049cea4b73d9d9eb079e0608d6]/fbcode/assistant/knowledge/search/external/faiss/faiss_c_api.cpp?lines=164 Created from CodeHub with https://fburl.com/edit-in-codehub Differential Revision: D79453787 fbshipit-source-id: 287916f83b35e501c3e293005d9cbea054a7475c --- c_api/Index_c.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_api/Index_c.cpp b/c_api/Index_c.cpp index 5df3c08ea..1c11239d5 100644 --- a/c_api/Index_c.cpp +++ b/c_api/Index_c.cpp @@ -195,7 +195,7 @@ int faiss_Index_compute_residual_n( int faiss_Index_sa_code_size(const FaissIndex* index, size_t* size) { try { - reinterpret_cast(index)->sa_code_size(); + *size = reinterpret_cast(index)->sa_code_size(); } CATCH_AND_HANDLE }