Skip to content

Commit c0c2cbb

Browse files
author
zourunxin.zrx
committed
add vids and const
1 parent 01d8d31 commit c0c2cbb

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

include/vsag/index.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class Index {
260260
*/
261261
virtual tl::expected<int64_t, Error>
262262
CalcBatchDistanceById(int64_t count,
263-
int64_t *vids,
263+
const int64_t *vids,
264264
const float* vector,
265265
float *&distances) const {
266266
throw std::runtime_error("Index doesn't support get distance by id");

src/algorithm/hnswlib/algorithm_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class AlgorithmInterface {
7171

7272
virtual int64_t
7373
getBatchDistanceByLabel(int64_t count,
74-
int64_t *vids,
75-
const void* data_point,
74+
const int64_t *vids,
75+
const void *data_point,
7676
float *&distances) = 0;
7777

7878
virtual const float*

src/algorithm/hnswlib/hnswalg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ HierarchicalNSW::getDistanceByLabel(LabelType label, const void* data_point) {
173173

174174
int64_t
175175
HierarchicalNSW::getBatchDistanceByLabel(int64_t count,
176-
int64_t *vids,
176+
const int64_t *vids,
177177
const void* data_point,
178178
float *&distances) {
179179
std::shared_lock lock_table(label_lookup_lock_);

src/algorithm/hnswlib/hnswalg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class HierarchicalNSW : public AlgorithmInterface<float> {
148148

149149
int64_t
150150
getBatchDistanceByLabel(int64_t count,
151-
int64_t *vids,
151+
const int64_t *vids,
152152
const void* data_point,
153153
float *&distances) override;
154154

src/algorithm/hnswlib/hnswalg_static.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,14 @@ class StaticHierarchicalNSW : public AlgorithmInterface<float> {
265265

266266
int64_t
267267
getBatchDistanceByLabel(int64_t count,
268-
int64_t *vids,
268+
const int64_t *vids,
269269
const void* data_point,
270270
float *&distances) override {
271271
std::shared_lock<std::shared_mutex> lock_table(shared_label_lookup_lock);
272272
int64_t ret_cnt = 0;
273273
distances = (float *)allocator_->Allocate(sizeof(float) * count);
274274
for (int i = 0; i < count; i++) {
275-
auto search = label_lookup_.find(vid[i]);
275+
auto search = label_lookup_.find(vids[i]);
276276
if (search == label_lookup_.end()) {
277277
distances[i] = -1;
278278
} else {

src/index/hnsw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ class HNSW : public Index {
147147

148148
virtual tl::expected<int64_t, Error>
149149
CalcBatchDistanceById(int64_t count,
150-
int64_t *vids,
150+
const int64_t *vids,
151151
const float* vector,
152152
float *&distances) const override {
153-
SAFE_CALL(return alg_hnsw_->getBatchDistanceByLabel(count, vid, vector, distances));
153+
SAFE_CALL(return alg_hnsw_->getBatchDistanceByLabel(count, vids, vector, distances));
154154
};
155155

156156
[[nodiscard]] bool

0 commit comments

Comments
 (0)