FaissSerializer.cpp 526 字节
Newer Older
X
Xu Peng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#include <easylogging++.h>
#include <faiss/AutoTune.h>

#include "FaissSerializer.h"

namespace zilliz {
namespace vecwise {
namespace engine {

const std::string IndexType = "IDMap,Flat";

FaissSerializer::FaissSerializer(uint16_t dimension)
    : pIndex_(faiss::index_factory(dimension, IndexType.c_str())) {
}

bool FaissSerializer::AddWithIds(long n, const float *xdata, const long *xids) {
    pIndex_->add_with_ids(n, xdata, xids);
    return true;
}


} // namespace engine
} // namespace vecwise
} // namespace zilliz