Skip to content

Commit b30a462

Browse files
authored
Add get_logger in multi index and enable clang format (#134)
This PR adds the `get_logger` utility in multi-vector index as well as applies clang format to files that were previously unformatted.
1 parent f5fd66d commit b30a462

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

examples/cpp/shared/shared.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ auto create_lvq_data() {
6969
template <typename Data, typename Distance>
7070
void vamana_build(Data& data, Distance distance) {
7171
auto parameters = svs::index::vamana::VamanaBuildParameters{
72-
1.2, // alpha
73-
64, // graph max degree
74-
128, // search window size
75-
750, // max candidate pool size
76-
60, // prune to degree
77-
true, // full search history
72+
1.2, // alpha
73+
64, // graph max degree
74+
128, // search window size
75+
750, // max candidate pool size
76+
60, // prune to degree
77+
true, // full search history
7878
};
7979

8080
auto tic = svs::lib::now();

include/svs/index/vamana/iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ template <typename Index, typename QueryType> class BatchIterator {
326326
bool restart_search_ = true; // Whether the next search should restart from scratch.
327327
size_t extra_search_buffer_capacity_ =
328328
svs::UNSIGNED_INTEGER_PLACEHOLDER; // Extra buffer capacity for the next search.
329-
bool is_exhausted_ = false; // Whether the iterator is exhausted.
329+
bool is_exhausted_ = false; // Whether the iterator is exhausted.
330330
};
331331

332332
// Deduction Guides

include/svs/index/vamana/multi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ class MultiMutableVamanaIndex {
295295
}
296296
const ParentIndex& get_parent_index() const { return *index_; }
297297

298+
svs::logging::logger_ptr get_logger() const { return index_->get_logger(); }
299+
298300
template <typename Query>
299301
double get_distance(label_type label, const Query& query) const {
300302
double best = INVALID_DISTANCE;

tests/svs/index/vamana/multi.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,15 @@ CATCH_TEMPLATE_TEST_CASE(
229229
CATCH_REQUIRE(test_distance == ref_distance);
230230
}
231231
}
232+
233+
CATCH_SECTION("Logging") {
234+
std::vector<size_t> test_indices(num_points);
235+
std::iota(test_indices.begin(), test_indices.end(), 0);
236+
237+
auto test_index = svs::index::vamana::MultiMutableVamanaIndex(
238+
build_parameters, data, test_indices, Distance(), num_threads
239+
);
240+
241+
CATCH_REQUIRE(ref_index.get_logger() == test_index.get_logger());
242+
}
232243
}

0 commit comments

Comments
 (0)