feat(db): add search api for db

Former-commit-id: 593c7ef1ea7a37022773cf49d82bd2b16763f173
pull/191/head
Xu Peng 2019-04-16 09:48:58 +08:00 committed by xj.lin
parent fa33addbf7
commit ee5d02939e
4 changed files with 15 additions and 0 deletions

View File

@ -29,6 +29,9 @@ public:
virtual Status add_vectors(const std::string& group_id_,
size_t n, const float* vectors, IDNumbers& vector_ids_) = 0;
virtual Status search(const std::string& group_id, size_t k, size_t nq,
const float* vectors, QueryResults& results) = 0;
DB() = default;
DB(const DB&) = delete;
DB& operator=(const DB&) = delete;

View File

@ -52,6 +52,12 @@ Status DBImpl::add_vectors(const std::string& group_id_,
}
}
Status DBImpl::search(const std::string& group_id, size_t k, size_t nq,
const float* vectors, QueryResults& results) {
// PXU TODO
return Status::OK();
}
void DBImpl::start_timer_task(int interval_) {
std::thread bg_task(&DBImpl::background_timer_task, this, interval_);
bg_task.detach();

View File

@ -31,6 +31,9 @@ public:
virtual Status add_vectors(const std::string& group_id_,
size_t n, const float* vectors, IDNumbers& vector_ids_) override;
virtual Status search(const std::string& group_id, size_t k, size_t nq,
const float* vectors, QueryResults& results) override;
virtual ~DBImpl();
private:

View File

@ -10,6 +10,9 @@ typedef long IDNumber;
typedef IDNumber* IDNumberPtr;
typedef std::vector<IDNumber> IDNumbers;
typedef std::vector<IDNumber> QueryResult;
typedef std::vector<QueryResult> QueryResults;
} // namespace engine
} // namespace vecwise