summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-02-05 10:12:22 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-02-05 10:12:22 +0000
commitdafacc957b8809d7b003a5909a76c99c83e88cc0 (patch)
tree07b9a92141d5745bf623f433794d16f67f787a51 /searchlib
parent166b192424bc38e16243adb2f925c6b7ff6d1e64 (diff)
Add function to array store that returns a writeable reference to an array.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index_base.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
index 3dcc0df477d..07f8077ae97 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
@@ -42,9 +42,9 @@ template <typename EntryT, typename RefT>
void
MultiValueMapping<EntryT,RefT>::replace(uint32_t docId, ConstArrayRef values)
{
- ConstArrayRef oldValues = _store.get(_indices[docId]);
+ auto oldValues = _store.get_writable(_indices[docId]);
assert(oldValues.size() == values.size());
- EntryT *dst = const_cast<EntryT *>(&oldValues[0]);
+ EntryT *dst = &oldValues[0];
for (auto &src : values) {
*dst = src;
++dst;
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index_base.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index_base.cpp
index bd53013b94d..0ec0348a398 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index_base.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index_base.cpp
@@ -63,11 +63,11 @@ void
HnswIndexBase::set_link_array(uint32_t docid, uint32_t level, const LinkArrayRef& links)
{
auto links_ref = _links.add(links);
- auto levels = get_level_array(docid);
- // TODO: Add function to ArrayStore that returns mutable array ref, eg. get_writable()
- auto mutable_levels = vespalib::unconstify(levels);
+ // TODO: Add memory barrier?
+ auto node_ref = _node_refs[docid];
+ auto levels = _nodes.get_writable(node_ref);
// TODO: Make this change atomic.
- mutable_levels[level] = links_ref;
+ levels[level] = links_ref;
}
bool