summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
index 42802cdd5db..3e260e8453a 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
@@ -27,7 +27,14 @@ SingleBoolAttribute::~SingleBoolAttribute()
bool
SingleBoolAttribute::addDoc(DocId & doc) {
- bool incGen = _bv.extend(getNumDocs() + 1);
+ size_t needSize = getNumDocs() + 1;
+ bool incGen = false;
+ if (_bv.capacity() < needSize) {
+ const GrowStrategy & gs = this->getConfig().getGrowStrategy();
+ uint32_t newSize = needSize + (needSize * gs.getDocsGrowFactor()) + gs.getDocsGrowDelta();
+ incGen = _bv.reserve(newSize);
+ }
+ incGen = _bv.extend(needSize) || incGen;
incNumDocs();
doc = getNumDocs() - 1;
updateUncommittedDocIdLimit(doc);