diff options
author | Tor Egge <Tor.Egge@online.no> | 2024-02-22 01:19:19 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2024-02-22 11:07:04 +0100 |
commit | 03565f4e4ec13b2d9485ce77dc2d7b01338bfab1 (patch) | |
tree | e3ff6d884b0f3f225ed2a364405f0f3d5d0e063e /searchlib | |
parent | 4f0947b6617f5c9ff0a133a1f12bb4a5b7d57bb6 (diff) |
Remove BTreeStore insert and remove member functions, use apply instead.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/predicate/simple_index.hpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp index 5d2380b523d..0516227081e 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp @@ -14,13 +14,15 @@ namespace simpleindex { template <typename Posting, typename Key, typename DocId> void -SimpleIndex<Posting, Key, DocId>::insertIntoPosting(vespalib::datastore::EntryRef &ref, Key key, DocId doc_id, const Posting &posting) { - bool ok = _btree_posting_lists.insert(ref, doc_id, posting); - if (!ok) { - _btree_posting_lists.remove(ref, doc_id); - ok = _btree_posting_lists.insert(ref, doc_id, posting); - } - assert(ok); +SimpleIndex<Posting, Key, DocId>::insertIntoPosting(vespalib::datastore::EntryRef &ref, Key key, DocId doc_id, const Posting &posting) +{ + typename BTreeStore::KeyDataType addition(doc_id, posting); + /* + * Note: existing value is overwritten by new value without + * cleanup. Data referenced by existing value might be leaked, + * but PredicateIntervalStore::remove() is already a noop. + */ + _btree_posting_lists.apply(ref, &addition, &addition + 1, nullptr, nullptr); insertIntoVectorPosting(ref, key, doc_id, posting); pruneBelowThresholdVectors(); } @@ -144,7 +146,7 @@ SimpleIndex<Posting, Key, DocId>::removeFromPostingList(Key key, DocId doc_id) { Posting posting = posting_it.getData(); vespalib::datastore::EntryRef original_ref(ref); - _btree_posting_lists.remove(ref, doc_id); + _btree_posting_lists.apply(ref, nullptr, nullptr, &doc_id, &doc_id + 1); removeFromVectorPostingList(ref, key, doc_id); if (!ref.valid()) { // last posting was removed _dictionary.remove(dict_it); |