Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C API] Additional API coverage: IndexLSH, I/O, meta-indexes #425

Merged
merged 4 commits into from
May 2, 2018

Conversation

Enet4
Copy link
Contributor

@Enet4 Enet4 commented Apr 27, 2018

This PR extends the C API with some some functions and types for accessing features in the library which may be useful in bindings. It is composed of 3 major contributions (feel free to let me know if you would like separate pull requests instead):

  • Bridged IndexLSH to the C interface, which to my understanding isn't accessible through the index factory.
  • Added most of "index_io.h" to the C header file "index_io_c.h", so as to enable saving and loading indices to/from disk. To serve as an example, "example_c.c" was extended to save the index in the end.
  • Added most of "MetaIndexes.h" to the C counterpart "MetaIndexes_c.h", thus allowing users to create index ID maps and index shards.

Although this is not yet fully tested, generating the low-level Rust bindings containing these changes was successful and did not interfere with the rest of the library (Travis build).

Enet4 added 4 commits March 26, 2018 20:31
- make index downcast declaration+definition possible with macros
- use macros on existing index types
- new header index_io_c.h for access to the index_io.h API
- function`faiss_write_index` and overloads for dumping index to a file
- function`faiss_read_index` and overloads for reading index from a file
- function`faiss_clone_index` for cloning an index
- update C example to save index to a file
@mdouze
Copy link
Contributor

mdouze commented May 2, 2018

This looks like a legitimate extension of the C api. Thanks!

@mdouze mdouze merged commit 9efdd8d into facebookresearch:master May 2, 2018
@Enet4 Enet4 deleted the c_api_update/more_index branch May 18, 2018 10:08
CaucherWang pushed a commit to CaucherWang/faiss-learned-termination that referenced this pull request Sep 16, 2022
…kresearch#425)

* [c_api] leverage index downcast

- make index downcast declaration+definition possible with macros
- use macros on existing index types

* [c_api] Add IndexLSH to C API

* [c_api] Add Index IO interface

- new header index_io_c.h for access to the index_io.h API
- function`faiss_write_index` and overloads for dumping index to a file
- function`faiss_read_index` and overloads for reading index from a file
- function`faiss_clone_index` for cloning an index
- update C example to save index to a file

* [c_api] Add IndexIDMap and IndexShards API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants