fix(wrapper): fix write index

Former-commit-id: 98af046872115568f3b4e7859bf6b6970b0655f6
This commit is contained in:
Xu Peng 2019-04-17 12:23:00 +08:00
parent 8d163abd42
commit 92983fcfbf
2 changed files with 9 additions and 3 deletions

View File

@ -62,6 +62,10 @@ bool Index::search(idx_t n, const float *data, idx_t k, float *distances, long *
return true;
}
void write_index(const Index_ptr &index, const std::string &file_name) {
write_index(index->index_.get(), file_name.c_str());
}
}
}
}

View File

@ -23,6 +23,9 @@ namespace zilliz {
namespace vecwise {
namespace engine {
class Index;
using Index_ptr = std::shared_ptr<Index>;
class Index {
typedef long idx_t;
@ -61,6 +64,7 @@ public:
// virtual bool index_display();
private:
friend void write_index(const Index_ptr &index, const std::string &file_name);
std::shared_ptr<faiss::Index> index_ = nullptr;
// std::vector<faiss::gpu::GpuResources *> res_;
// std::vector<int> devs_;
@ -69,9 +73,8 @@ private:
// faiss::gpu::GpuMultipleClonerOptions *options = new faiss::gpu::GpuMultipleClonerOptions();
};
using Index_ptr = std::shared_ptr<Index>;
extern void write_index(const Index_ptr &index, const std::string &file_name);
void write_index(const Index_ptr &index, const std::string &file_name);
extern Index_ptr read_index(const std::string &file_name);
@ -79,4 +82,3 @@ extern Index_ptr read_index(const std::string &file_name);
}
}
}