From 4080369f2b07de530c859d7d9f0935afdc4f7eb4 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 14 Nov 2023 19:35:51 +0000 Subject: Only allow use of bitvector if it is a filter --- .../src/tests/attribute/bitvector/bitvector_test.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp index 63c0b784018..dfea4901180 100644 --- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp @@ -43,9 +43,8 @@ struct BitVectorTest { using AttributePtr = AttributeVector::SP; - BitVectorTest() { } - - ~BitVectorTest() { } + BitVectorTest(); + ~BitVectorTest(); template VectorType & as(AttributePtr &v); @@ -102,6 +101,9 @@ struct BitVectorTest test(BasicType bt, CollectionType ct, const vespalib::string &pref); }; +BitVectorTest::BitVectorTest() = default; +BitVectorTest::~BitVectorTest() = default; + template VectorType & @@ -427,16 +429,14 @@ BitVectorTest::test(BasicType bt, CollectionType ct, const vespalib::string &pre SearchContextPtr sc = getSearch(tv, true); checkSearch(v, std::move(sc), 2, 1022, 205, !fastSearch && !filter, true); - sc = getSearch(tv, false); + sc = getSearch(tv, filter); checkSearch(v, std::move(sc), 2, 1022, 205, !filter, true); const search::IDocumentWeightAttribute *dwa = v->asDocumentWeightAttribute(); if (dwa != nullptr) { - search::IDocumentWeightAttribute::LookupResult lres = - dwa->lookup(getSearchStr(), dwa->get_dictionary_snapshot()); + auto lres = dwa->lookup(getSearchStr(), dwa->get_dictionary_snapshot()); using DWSI = search::queryeval::DocumentWeightSearchIterator; - using SI = search::queryeval::SearchIterator; TermFieldMatchData md; - SI::UP dwsi(new DWSI(md, *dwa, lres)); + auto dwsi = std::make_unique(md, *dwa, lres); if (!filter) { TEST_DO(checkSearch(v, std::move(dwsi), md, 2, 1022, 205, !filter, true)); } else { @@ -445,13 +445,13 @@ BitVectorTest::test(BasicType bt, CollectionType ct, const vespalib::string &pre } } populate(tv, 2, 973, false); - sc = getSearch(tv, true); + sc = getSearch(tv, filter); checkSearch(v, std::move(sc), 977, 1022, 10, !filter, true); populate(tv, 2, 973, true); sc = getSearch(tv, true); checkSearch(v, std::move(sc), 2, 1022, 205, !fastSearch && !filter, true); addDocs(v, 15000); - sc = getSearch(tv, true); + sc = getSearch(tv, filter); checkSearch(v, std::move(sc), 2, 1022, 205, !filter, true); populateAll(tv, 10, 15000, true); sc = getSearch(tv, true); -- cgit v1.2.3 From 16d6f96c09716227e9b847c4c4e534e692401a02 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 14 Nov 2023 19:37:36 +0000 Subject: - Create bitvector when freqency > 1/64, up from 1/32 - Destruct bitvector when frequency falls below 1/128 instead of 1/64. A posting is currently 8 bytes(docid+weight) + btree overhead, so that will give a smoother memory cost. In addition filter queries should be faster. --- searchlib/src/vespa/searchlib/attribute/postingstore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp index 8bee8b3f7f7..ca56274bd36 100644 --- a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp @@ -44,8 +44,8 @@ PostingStoreBase2::resizeBitVectors(uint32_t newSize, uint32_t newCapacity) newSize = newCapacity; if (newSize == _bvSize && newCapacity == _bvCapacity) return false; - _minBvDocFreq = std::max(newSize >> 6, 64u); - _maxBvDocFreq = std::max(newSize >> 5, 128u); + _minBvDocFreq = std::max(newSize >> 7, 64u); + _maxBvDocFreq = std::max(newSize >> 6, 128u); if (_bvs.empty()) { _bvSize = newSize; _bvCapacity = newCapacity; -- cgit v1.2.3