The function usearch_get consistently returns 1, regardless of the positive number of vectors actually copied to the buffer. I observed that in C# and then went down to C99 implementation.
I am using the newest main-dev branch.
Steps to reproduce
That function assumed to be inserted into c/test.c and called directly from main()
void test_get_multiple_vectors_from_one_key() {
// initialization
usearch_error_t error = NULL;
size_t vector_dimension = 2;
usearch_init_options_t opts = create_options(vector_dimension);
opts.multi = true;
usearch_index_t idx = usearch_init(&opts, &error);
ASSERT(!error, error);
// adding vectors
usearch_reserve(idx, 4, &error);
ASSERT(!error, error);
float vector[] = {1, 2, 3, 4, 5, 6, 7, 8};
usearch_key_t key = 1;
for (size_t i = 0; i < 4; ++i) {
usearch_add(idx, key, &vector[i * vector_dimension], usearch_scalar_f32_k, &error);
ASSERT(!error, error);
}
// retrieve vectors from index
float* vector_buffer = (float*)malloc(10 * sizeof(float));
size_t count = usearch_get(idx, key, 4, vector_buffer, usearch_scalar_f32_k, &error);
// 1 will be printed
printf("count: %d\n", (int)count);
// Though this prints 7, 8, 5, 6, 3, 4, 1, 2
for (int i = 0; i < 8; ++i)
printf("%.f ", vector_buffer[i]);
usearch_free(idx, &error);
ASSERT(!error, error);
free(vector_buffer);
}
Expected behavior
usearch_get() return the correct number of vectors copied to the buffer.
USearch version
v1.1.0
Operating System
Ubuntu 22.04
Hardware architecture
x86
Which interface are you using?
Other bindings
Contact Details
No response
Is there an existing issue for this?
[X] I have searched the existing issues
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Describe the bug
The function
usearch_get
consistently returns 1, regardless of the positive number of vectors actually copied to the buffer. I observed that in C# and then went down to C99 implementation.I am using the newest
main-dev
branch.Steps to reproduce
That function assumed to be inserted into
c/test.c
and called directly frommain()
Expected behavior
usearch_get()
return the correct number of vectors copied to the buffer.USearch version
v1.1.0
Operating System
Ubuntu 22.04
Hardware architecture
x86
Which interface are you using?
Other bindings
Contact Details
No response
Is there an existing issue for this?
Code of Conduct