Skip to content

Commit cc071bb

Browse files
author
zourunxin.zrx
committed
extra info
1 parent 4292c03 commit cc071bb

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

extern/vsag.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ include (FetchContent)
44
#set(vsag_BINARY_DIR ${CMAKE_BINARY_DIR}/_deps/vsag-src/)
55
FetchContent_Declare(
66
vsag
7-
URL https://github.com/lyxiong0/vsag/archive/refs/tags/iter_filter0.1.tar.gz
8-
URL_HASH MD5=b446b95f520400d2711c3c9324a03678
7+
URL https://github.com/Carrot-77/vsag/archive/refs/tags/vsag_435bp2.tar.gz
8+
URL_HASH MD5=614625006756f9679502226d00d26788
99
DOWNLOAD_NO_PROGRESS 0
1010
INACTIVITY_TIMEOUT 20
1111
TIMEOUT 120

ob_vsag_lib.cpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,9 @@ int HnswIndexHandler::knn_search(const vsag::DatasetPtr& query, int64_t topk,
273273
tl::expected<std::shared_ptr<vsag::Dataset>, vsag::Error> result;
274274
auto vsag_filter = std::make_shared<ObVasgFilter>(valid_ratio, filter);
275275
vsag::IteratorContext* input_iter = static_cast<vsag::IteratorContext*>(iter_ctx);
276-
if (index_type == HNSW_TYPE || index_type == HGRAPH_TYPE || index_type == HNSW_SQ_TYPE) {
277-
result = index_->KnnSearch(query, topk, parameters, bitmap == nullptr ? nullptr : vsag_filter, input_iter, is_last_search);
278-
iter_ctx = input_iter;
279-
} else {
280-
error = vsag::ErrorType::UNSUPPORTED_INDEX;
281-
vsag::logger::error("knn search iter filter not support BQ.");
282-
}
276+
result = index_->KnnSearch(query, topk, parameters, bitmap == nullptr ? nullptr : vsag_filter, input_iter, is_last_search);
283277
if (result.has_value()) {
284-
//result的生命周期
278+
iter_ctx = input_iter;
285279
result.value()->Owner(false);
286280
ids = result.value()->GetIds();
287281
dist = result.value()->GetDistances();
@@ -387,17 +381,16 @@ int create_index(VectorIndexPtr& index_handler, IndexType index_type,
387381
{"max_degree", max_degree * 2},
388382
{"ef_construction", ef_construction},
389383
{"build_thread_count", 1}};
390-
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"index_param", hnswsq_parameters}};
384+
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"extra_info_size", extra_info_size}, {"index_param", hnswsq_parameters}};
391385
} else if (index_type == HGRAPH_TYPE) {
392386
// create hnsw fp index
393387
index_type_str = "hgraph";
394388
nlohmann::json hnswsq_parameters{{"base_quantization_type", "fp32"},
395389
// NOTE(liyao): max_degree compatible with behavior of HNSW, which is doubling the m value
396390
{"max_degree", max_degree * 2},
397391
{"ef_construction", ef_construction},
398-
{"build_thread_count", 1},
399-
{"extra_info_size", extra_info_size}};
400-
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"index_param", hnswsq_parameters}};
392+
{"build_thread_count", 1}};
393+
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"extra_info_size", extra_info_size}, {"index_param", hnswsq_parameters}};
401394
} else if (index_type == HNSW_BQ_TYPE) {
402395
// create hnsw bq index
403396
index_type_str = "hgraph";
@@ -410,7 +403,7 @@ int create_index(VectorIndexPtr& index_handler, IndexType index_type,
410403
{"ignore_reorder", true},
411404
{"precise_quantization_type", "fp32"},
412405
{"precise_io_type", "block_memory_io"}};
413-
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"index_param", hnswsq_parameters}};
406+
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"extra_info_size", extra_info_size}, {"index_param", hnswsq_parameters}};
414407
} else if (!is_support) {
415408
error = vsag::ErrorType::UNSUPPORTED_INDEX;
416409
vsag::logger::debug(" fail to create hnsw index , index type not supported:{}", static_cast<int>(index_type));
@@ -715,7 +708,7 @@ int fdeserialize(VectorIndexPtr& index_handler, std::istream& in_stream) {
715708
{"max_degree", max_degree},
716709
{"ef_construction", ef_construction},
717710
{"build_thread_count", 1}};
718-
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"index_param", hnswsq_parameters}};
711+
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"extra_info_size", extra_info_size}, {"index_param", hnswsq_parameters}};
719712
} else if (HNSW_BQ_TYPE == index_type) {
720713
nlohmann::json hnswbq_parameters{{"base_quantization_type", "rabitq"},
721714
{"max_degree", max_degree},
@@ -725,14 +718,13 @@ int fdeserialize(VectorIndexPtr& index_handler, std::istream& in_stream) {
725718
{"ignore_reorder", true},
726719
{"precise_quantization_type", "fp32"},
727720
{"precise_io_type", "block_memory_io"}};
728-
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"index_param", hnswbq_parameters}};
721+
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"extra_info_size", extra_info_size}, {"index_param", hnswbq_parameters}};
729722
} else if (HGRAPH_TYPE == index_type) {
730723
nlohmann::json hnswsq_parameters{{"base_quantization_type", base_quantization_type},
731724
{"max_degree", max_degree},
732725
{"ef_construction", ef_construction},
733-
{"build_thread_count", 1},
734-
{"extra_info_size", extra_info_size}};
735-
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"index_param", hnswsq_parameters}};
726+
{"build_thread_count", 1}};
727+
index_parameters = {{"dtype", dtype}, {"metric_type", metric}, {"dim", dim}, {"extra_info_size", extra_info_size}, {"index_param", hnswsq_parameters}};
736728
}
737729

738730
vsag::logger::debug(" Deserilize hnsw index , index parameter:{}, allocator addr:{}",index_parameters.dump(),(void*)hnsw->get_allocator());

0 commit comments

Comments
 (0)