diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-10-26 12:09:37 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-10-26 12:09:37 +0200 |
commit | 9e7cd01437f96c8089a8bf242f7dc1aafd575143 (patch) | |
tree | bab737550ffb0a24091ae5556442b0e4cacb1fc3 | |
parent | b2c4e8e935ed4ccc9cefda423134d8ecf1252eb4 (diff) |
Rename HNSW graph member functions:
make_node_for_document => make_node
remove_node_for_document => remove_node
5 files changed, 16 insertions, 16 deletions
diff --git a/searchlib/src/tests/tensor/hnsw_saver/hnsw_save_load_test.cpp b/searchlib/src/tests/tensor/hnsw_saver/hnsw_save_load_test.cpp index d85c1c17018..ea22aaabaff 100644 --- a/searchlib/src/tests/tensor/hnsw_saver/hnsw_save_load_test.cpp +++ b/searchlib/src/tests/tensor/hnsw_saver/hnsw_save_load_test.cpp @@ -52,12 +52,12 @@ using V = std::vector<uint32_t>; void populate(HnswGraph &graph) { // no 0 - graph.make_node_for_document(1, 1); - auto er = graph.make_node_for_document(2, 2); + graph.make_node(1, 1); + auto er = graph.make_node(2, 2); // no 3 - graph.make_node_for_document(4, 2); - graph.make_node_for_document(5, 0); - graph.make_node_for_document(6, 1); + graph.make_node(4, 2); + graph.make_node(5, 0); + graph.make_node(6, 1); graph.set_link_array(1, 0, V{2, 4, 6}); graph.set_link_array(2, 0, V{1, 4, 6}); @@ -69,9 +69,9 @@ void populate(HnswGraph &graph) { } void modify(HnswGraph &graph) { - graph.remove_node_for_document(2); - graph.remove_node_for_document(6); - graph.make_node_for_document(7, 2); + graph.remove_node(2); + graph.remove_node(6); + graph.make_node(7, 2); graph.set_link_array(1, 0, V{7, 4}); graph.set_link_array(4, 0, V{7, 2}); diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp index 57122bb589f..6d8b143cff9 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp @@ -21,7 +21,7 @@ HnswGraph::HnswGraph() HnswGraph::~HnswGraph() = default; HnswGraph::NodeRef -HnswGraph::make_node_for_document(uint32_t nodeid, uint32_t num_levels) +HnswGraph::make_node(uint32_t nodeid, uint32_t num_levels) { node_refs.ensure_size(nodeid + 1, AtomicEntryRef()); // A document cannot be added twice. @@ -37,7 +37,7 @@ HnswGraph::make_node_for_document(uint32_t nodeid, uint32_t num_levels) } void -HnswGraph::remove_node_for_document(uint32_t nodeid) +HnswGraph::remove_node(uint32_t nodeid) { auto node_ref = get_node_ref(nodeid); assert(node_ref.valid()); diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h index a3d0b39ed9f..60ba7d55f7f 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h @@ -48,9 +48,9 @@ struct HnswGraph { HnswGraph(); ~HnswGraph(); - NodeRef make_node_for_document(uint32_t nodeid, uint32_t num_levels); + NodeRef make_node(uint32_t nodeid, uint32_t num_levels); - void remove_node_for_document(uint32_t nodeid); + void remove_node(uint32_t nodeid); void trim_node_refs_size(); diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp index 554b5a1a80a..89b4f62146c 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp @@ -412,7 +412,7 @@ void HnswIndex::internal_complete_add(uint32_t docid, PreparedAddDoc &op) { auto nodeid = get_nodeid(docid); - auto node_ref = _graph.make_node_for_document(nodeid, op.max_level + 1); + auto node_ref = _graph.make_node(nodeid, op.max_level + 1); for (int level = 0; level <= op.max_level; ++level) { auto neighbors = filter_valid_nodeids(level, op.connections[level], nodeid); connect_new_node(nodeid, neighbors, level); @@ -501,7 +501,7 @@ HnswIndex::remove_node(uint32_t nodeid) HnswGraph::EntryNode entry; _graph.set_entry_node(entry); } - _graph.remove_node_for_document(nodeid); + _graph.remove_node(nodeid); } void @@ -771,7 +771,7 @@ HnswIndex::set_node(uint32_t nodeid, const HnswNode &node) { size_t num_levels = node.size(); assert(num_levels > 0); - auto node_ref = _graph.make_node_for_document(nodeid, num_levels); + auto node_ref = _graph.make_node(nodeid, num_levels); for (size_t level = 0; level < num_levels; ++level) { connect_new_node(nodeid, node.level(level), level); } diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp index 98505458649..1c38e7d7936 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp @@ -43,7 +43,7 @@ HnswIndexLoader<ReaderType>::load_next() if (_nodeid < _num_nodes) { uint32_t num_levels = next_int(); if (num_levels > 0) { - _graph.make_node_for_document(_nodeid, num_levels); + _graph.make_node(_nodeid, num_levels); for (uint32_t level = 0; level < num_levels; ++level) { uint32_t num_links = next_int(); _link_array.clear(); |