yahoojapan / NGT

Nearest Neighbor Search with Neighborhood Graph and Tree for High-dimensional Data
Apache License 2.0
1.22k stars 112 forks source link

Add more ngt_insert_index_as_TYPE methods to C API #136

Closed lerouxrgd closed 1 year ago

lerouxrgd commented 1 year ago

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:

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

masajiro commented 1 year ago

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

lerouxrgd commented 1 year ago

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.