Skip to content

Commit d112c87

Browse files
committed
add: WIP Phase 4 second pass; Fix filtered_vamana test compilation
Successfully built and run the new filtered Vamana test. What We Fixed: 1. Compilation error in test (unit_filtered_vamana.cc:206): Fixed typo where query_filter was passed twice instead of query, query_filter 2. Template compilation error: Added if constexpr (requires { db.ids(); }) protection in filtered_greedy_search_multi_start to handle types without an ids() method 3. New test passes: All 5 test cases in unit_filtered_vamana pass with 41 assertions Remaining Issues: 4 existing Vamana tests are hanging (not segfaulting): - unit_vamana_index_test - unit_vamana_group_test - unit_vamana_metadata_test - unit_api_vamana_index_test These failures pre-exist our session (from the Phase 1-4 commits). The latest commit message was "WIP Phase 4 first pass; Getting previous tests to pass", confirming these were already failing. Next Steps to fix the hanging tests: 1. Debug why tests hang (likely infinite loop in graph construction) 2. Check if empty start_points vector causes issues when filter_labels_[p] is empty 3. Possibly add similar if constexpr protection to greedy_search_O1:427
1 parent 7070d3a commit d112c87

3 files changed

Lines changed: 459 additions & 3 deletions

File tree

src/include/detail/graph/greedy_search.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,18 @@ auto filtered_greedy_search_multi_start(
755755
get_top_k_with_scores_from_heap(result, top_k, top_k_scores);
756756

757757
// Optionally convert from vector indexes to db IDs
758+
// Use if constexpr to only compile this if db has an ids() method
758759
if (convert_to_db_ids) {
759-
for (size_t i = 0; i < k_nn; ++i) {
760-
if (top_k[i] != std::numeric_limits<id_type>::max()) {
761-
top_k[i] = db.ids()[top_k[i]];
760+
if constexpr (requires { db.ids(); }) {
761+
for (size_t i = 0; i < k_nn; ++i) {
762+
if (top_k[i] != std::numeric_limits<id_type>::max()) {
763+
top_k[i] = db.ids()[top_k[i]];
764+
}
762765
}
766+
} else {
767+
throw std::runtime_error(
768+
"[filtered_greedy_search_multi_start] convert_to_db_ids=true but db type "
769+
"does not have ids() method");
763770
}
764771
}
765772

src/include/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ kmeans_add_test(unit_vamana_group)
7070

7171
kmeans_add_test(unit_vamana_metadata)
7272

73+
kmeans_add_test(unit_filtered_vamana)
74+
7375
kmeans_add_test(unit_adj_list)
7476

7577
kmeans_add_test(unit_algorithm)

0 commit comments

Comments
 (0)