vec_impl.h 1.8 KB
Newer Older
X
MS-154  
xj.lin 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "knowhere/index/vector_index/vector_index.h"

#include "vec_index.h"


namespace zilliz {
X
xj.lin 已提交
15
namespace milvus {
X
MS-154  
xj.lin 已提交
16 17 18 19 20 21 22 23 24 25 26
namespace engine {

class VecIndexImpl : public VecIndex {
 public:
    explicit VecIndexImpl(std::shared_ptr<zilliz::knowhere::VectorIndex> index) : index_(std::move(index)) {};
    void BuildAll(const long &nb,
                  const float *xb,
                  const long *ids,
                  const Config &cfg,
                  const long &nt,
                  const float *xt) override;
X
xj.lin 已提交
27 28
    int64_t Dimension() override;
    int64_t Count() override;
X
MS-154  
xj.lin 已提交
29 30 31 32 33
    void Add(const long &nb, const float *xb, const long *ids, const Config &cfg) override;
    zilliz::knowhere::BinarySet Serialize() override;
    void Load(const zilliz::knowhere::BinarySet &index_binary) override;
    void Search(const long &nq, const float *xq, float *dist, long *ids, const Config &cfg) override;

X
xj.lin 已提交
34
 protected:
X
xj.lin 已提交
35
    int64_t dim = 0;
X
MS-154  
xj.lin 已提交
36 37 38
    std::shared_ptr<zilliz::knowhere::VectorIndex> index_ = nullptr;
};

X
xj.lin 已提交
39 40 41 42 43
class BFIndex : public VecIndexImpl {
 public:
    explicit BFIndex(std::shared_ptr<zilliz::knowhere::VectorIndex> index) : VecIndexImpl(std::move(index)) {};
    void Build(const int64_t& d);
    float* GetRawVectors();
X
xj.lin 已提交
44 45 46 47 48 49
    void BuildAll(const long &nb,
                  const float *xb,
                  const long *ids,
                  const Config &cfg,
                  const long &nt,
                  const float *xt) override;
X
xj.lin 已提交
50 51 52
    int64_t* GetRawIds();
};

X
MS-154  
xj.lin 已提交
53 54 55
}
}
}