Update index api

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
pull/4973/head^2
bigsheeper 2020-09-21 16:16:14 +08:00 committed by yefu.chen
parent 99d0a69e6a
commit 38806b2c9d
4 changed files with 7 additions and 5 deletions

View File

@ -22,7 +22,7 @@ DeleteCollection(CCollection collection) {
delete col; delete col;
} }
void UpdateIndexs(CCollection c_collection, const char *index_string) { void UpdateIndexes(CCollection c_collection, const char *index_string) {
auto c = (milvus::dog_segment::Collection*)c_collection; auto c = (milvus::dog_segment::Collection*)c_collection;
std::string s(index_string); std::string s(index_string);
c->CreateIndex(s); c->CreateIndex(s);

View File

@ -10,7 +10,7 @@ NewCollection(const char* collection_name, const char* schema_conf);
void void
DeleteCollection(CCollection collection); DeleteCollection(CCollection collection);
void UpdateIndexs(CCollection c_collection, const char *index_string); void UpdateIndexes(CCollection c_collection, const char *index_string);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,6 +1,7 @@
#include <cstring> #include <cstring>
#include "SegmentBase.h" #include "SegmentBase.h"
#include "Collection.h"
#include "segment_c.h" #include "segment_c.h"
#include "Partition.h" #include "Partition.h"
#include <knowhere/index/vector_index/VecIndex.h> #include <knowhere/index/vector_index/VecIndex.h>
@ -162,9 +163,10 @@ Close(CSegmentBase c_segment) {
} }
int int
BuildIndex(CSegmentBase c_segment) { BuildIndex(CCollection c_collection, CSegmentBase c_segment) {
auto collection = (milvus::dog_segment::Collection*)c_collection;
auto segment = (milvus::dog_segment::SegmentBase*)c_segment; auto segment = (milvus::dog_segment::SegmentBase*)c_segment;
auto status = segment->BuildIndex(nullptr); auto status = segment->BuildIndex(collection->get_index());
return status.code(); return status.code();
} }

View File

@ -68,7 +68,7 @@ int
Close(CSegmentBase c_segment); Close(CSegmentBase c_segment);
int int
BuildIndex(CSegmentBase c_segment); BuildIndex(CCollection c_collection, CSegmentBase c_segment);
bool bool
IsOpened(CSegmentBase c_segment); IsOpened(CSegmentBase c_segment);