summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2021-03-15 14:17:37 +0100
committerTor Egge <Tor.Egge@broadpark.no>2021-03-15 14:17:37 +0100
commit04afb658074a9fc054bf3dd47ae91cd2b8aee39a (patch)
tree9cddfb0e50a420790e9c1a452684bdf8f05399ba /searchlib
parentd2d50a6d60fd255cc95b623c9992d7273f4bfdf2 (diff)
Use update_posting_list method on dictionary to partially clear
posting list for default value when shrinking lid space.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
index ccf248a7c15..f39a8c7503d 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
@@ -168,22 +168,16 @@ clearPostings(attribute::IAttributeVector::EnumHandle eidx,
}
EntryRef er(eidx);
- auto& dict = _dictionary.get_posting_dictionary();
- auto itr = dict.lowerBound(er, cmp);
- assert(itr.valid());
-
- EntryRef newPosting(itr.getData());
- assert(newPosting.valid());
-
- _postingList.apply(newPosting,
- &postings._additions[0],
- &postings._additions[0] +
- postings._additions.size(),
- &postings._removals[0],
- &postings._removals[0] +
- postings._removals.size());
- dict.thaw(itr);
- itr.writeData(newPosting.ref());
+ auto updater = [this, &postings](EntryRef posting_idx) -> EntryRef
+ {
+ _postingList.apply(posting_idx,
+ &postings._additions[0],
+ &postings._additions[0] + postings._additions.size(),
+ &postings._removals[0],
+ &postings._removals[0] + postings._removals.size());
+ return posting_idx;
+ };
+ _dictionary.update_posting_list(er, cmp, updater);
}
template <typename P>