yahoojapan/NGT

Add more ngt_insert_index_as_TYPE methods to C API

lerouxrgd opened this issue · 2 comments

Hello,

In ngt-rs I am now trying to enforce index type at compile time, which would look like that: NgtIndex<f32>, NgtIndex<u8> or NgtIndex<f16>.

Therefore, the insert method would need to be templated to take a Vec<T> instead of Vec<f32>. Currently the ngt-rs wrapper enforces f32 usage (even if NgtObjectType is something else like u8 or f16) because under the hood it uses ngt_insert_index_as_float from the C API.

Would it be possible to have the following methods added to the C API:

  • ngt_insert_index_as_uint8(NGTIndex, uint8_t*, uint32_t, NGTError);
  • ngt_insert_index_as_float16(NGTIndex, float16*, uint32_t, NGTError);

So that ngt-rs wrapper could leverage them for better indexes.

Hello,
I have released V2.0.12 which includes your request. NGTFloat16 in the arguments is just void defined by typedef.

Hello @masajiro ,

Thank you very much, it all looks good for NGT index !
Besides, I have actually realized that similar functions would be required for QBG index too, I will open a new issue for that.