summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/searchcontext/CMakeLists.txt2
-rw-r--r--searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp (renamed from searchlib/src/tests/attribute/searchcontext/searchcontext.cpp)125
-rw-r--r--searchlib/src/tests/bitvector/bitvectorbenchmark.cpp2
-rw-r--r--searchlib/src/tests/common/bitvector/bitvector_test.cpp22
-rw-r--r--searchlib/src/tests/queryeval/queryeval.cpp17
-rw-r--r--searchlib/src/vespa/searchlib/aggregation/hitlist.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp5
-rw-r--r--searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/common/bitvector.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/common/bitvector.h29
-rw-r--r--searchlib/src/vespa/searchlib/common/sortspec.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/field_length_scanner.h1
-rw-r--r--searchlib/src/vespa/searchlib/docstore/documentstore.cpp14
-rw-r--r--searchlib/src/vespa/searchlib/expression/aggregationrefnode.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/expression/resultnode.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/expression/resultnodes.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/index/postinglisthandle.h1
-rw-r--r--searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/util/fileutil.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/util/url.cpp1
21 files changed, 164 insertions, 86 deletions
diff --git a/searchlib/src/tests/attribute/searchcontext/CMakeLists.txt b/searchlib/src/tests/attribute/searchcontext/CMakeLists.txt
index a705fd5ecb5..377d91bf634 100644
--- a/searchlib/src/tests/attribute/searchcontext/CMakeLists.txt
+++ b/searchlib/src/tests/attribute/searchcontext/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(searchlib_searchcontext_test_app TEST
SOURCES
- searchcontext.cpp
+ searchcontext_test.cpp
DEPENDS
searchlib
searchlib_test
diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
index 7d4a2d63355..416ddb5fbc0 100644
--- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp
+++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
@@ -1,24 +1,27 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include <vespa/searchlib/attribute/attribute.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributeiterators.h>
+#include <vespa/searchlib/attribute/attributevector.hpp>
+#include <vespa/searchlib/attribute/elementiterator.h>
#include <vespa/searchlib/attribute/flagattribute.h>
+#include <vespa/searchlib/attribute/multistringattribute.h>
+#include <vespa/searchlib/attribute/singleboolattribute.h>
#include <vespa/searchlib/attribute/singlenumericattribute.h>
#include <vespa/searchlib/attribute/singlestringattribute.h>
-#include <vespa/searchlib/attribute/multistringattribute.h>
-#include <vespa/searchlib/attribute/elementiterator.h>
#include <vespa/searchlib/common/bitvectoriterator.h>
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
-#include <vespa/searchlib/queryeval/hitcollector.h>
+#include <vespa/searchlib/parsequery/parse.h>
+#include <vespa/searchlib/query/query_term_simple.h>
#include <vespa/searchlib/queryeval/emptysearch.h>
#include <vespa/searchlib/queryeval/executeinfo.h>
+#include <vespa/searchlib/queryeval/hitcollector.h>
+#include <vespa/searchlib/queryeval/simpleresult.h>
+#include <vespa/searchlib/test/searchiteratorverifier.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/compress.h>
-#include <vespa/searchlib/test/searchiteratorverifier.h>
-#include <vespa/searchlib/query/query_term_simple.h>
-#include <vespa/searchlib/parsequery/parse.h>
-#include <vespa/searchlib/attribute/attributevector.hpp>
#include <vespa/log/log.h>
LOG_SETUP("searchcontext_test");
@@ -43,22 +46,24 @@ isUnsignedSmallIntAttribute(const AttributeVector &a)
}
-typedef AttributeVector::SP AttributePtr;
-typedef std::unique_ptr<AttributeVector::SearchContext> SearchContextPtr;
-typedef AttributeVector::SearchContext SearchContext;
-using attribute::Config;
+using AttributePtr = AttributeVector::SP;
+using ResultSetPtr = std::unique_ptr<ResultSet>;
+using SearchBasePtr = queryeval::SearchIterator::UP;
+using SearchContext = AttributeVector::SearchContext;
+using SearchContextPtr = std::unique_ptr<AttributeVector::SearchContext>;
+using largeint_t = AttributeVector::largeint_t;
+
using attribute::BasicType;
using attribute::CollectionType;
-typedef AttributeVector::largeint_t largeint_t;
-typedef queryeval::SearchIterator::UP SearchBasePtr;
-typedef std::unique_ptr<ResultSet> ResultSetPtr;
-
-using queryeval::HitCollector;
-using queryeval::SearchIterator;
+using attribute::Config;
+using attribute::SearchContextParams;
using fef::MatchData;
using fef::TermFieldMatchData;
using fef::TermFieldMatchDataArray;
using fef::TermFieldMatchDataPosition;
+using queryeval::HitCollector;
+using queryeval::SearchIterator;
+using queryeval::SimpleResult;
class DocSet : public std::set<uint32_t>
{
@@ -267,6 +272,9 @@ private:
void requireThatOutOfBoundsSearchTermGivesZeroHits(const vespalib::string &name, const Config &cfg, int64_t maxValue);
void requireThatOutOfBoundsSearchTermGivesZeroHits();
+ void single_bool_attribute_search_context_handles_true_and_false_queries();
+ void single_bool_attribute_search_iterator_handles_true_and_false_queries();
+
// init maps with config objects
void initIntegerConfig();
void initFloatConfig();
@@ -1825,6 +1833,87 @@ SearchContextTest::requireThatOutOfBoundsSearchTermGivesZeroHits()
}
}
+class BoolAttributeFixture {
+private:
+ search::SingleBoolAttribute _attr;
+
+public:
+ BoolAttributeFixture(const SimpleResult& true_docs, uint32_t num_docs)
+ : _attr("bool_attr", search::GrowStrategy())
+ {
+ _attr.addDocs(num_docs);
+ for (uint32_t i = 0; i < true_docs.getHitCount(); ++i) {
+ uint32_t docid = true_docs.getHit(i);
+ _attr.update(docid, 1);
+ }
+ _attr.commit();
+ }
+ search::AttributeVector::SearchContext::UP create_search_context(const std::string& term) const {
+ return _attr.getSearch(std::make_unique<search::QueryTermSimple>(term, search::QueryTermSimple::WORD),
+ SearchContextParams().useBitVector(true));
+ }
+ SimpleResult search_context(const std::string& term) const {
+ auto search_ctx = create_search_context(term);
+ SimpleResult result;
+ int32_t weight = 10;
+ for (uint32_t docid = 1; docid < _attr.getNumDocs(); ++docid) {
+ bool match_1 = search_ctx->matches(docid);
+ bool match_2 = search_ctx->matches(docid, weight);
+ EXPECT_EQUAL(match_1, match_2);
+ EXPECT_EQUAL(match_2 ? 1 : 0, weight);
+ if (match_1) {
+ result.addHit(docid);
+ }
+ weight = 10;
+ }
+ return result;
+ }
+ SimpleResult search_iterator(const std::string& term, bool strict) const {
+ auto search_ctx = create_search_context(term);
+ TermFieldMatchData tfmd;
+ auto itr = search_ctx->createIterator(&tfmd, strict);
+ SimpleResult result;
+ if (strict) {
+ result.searchStrict(*itr, _attr.getNumDocs());
+ } else {
+ result.search(*itr, _attr.getNumDocs());
+ }
+ return result;
+ }
+};
+
+void
+SearchContextTest::single_bool_attribute_search_context_handles_true_and_false_queries()
+{
+ BoolAttributeFixture f(SimpleResult().addHit(3).addHit(5).addHit(7), 9);
+
+ auto true_exp = SimpleResult().addHit(3).addHit(5).addHit(7);
+ EXPECT_EQUAL(true_exp, f.search_context("true"));
+ EXPECT_EQUAL(true_exp, f.search_context("1"));
+
+ auto false_exp = SimpleResult().addHit(1).addHit(2).addHit(4).addHit(6).addHit(8);
+ EXPECT_EQUAL(false_exp, f.search_context("false"));
+ EXPECT_EQUAL(false_exp, f.search_context("0"));
+}
+
+void
+SearchContextTest::single_bool_attribute_search_iterator_handles_true_and_false_queries()
+{
+ BoolAttributeFixture f(SimpleResult().addHit(3).addHit(5).addHit(7), 9);
+
+ auto true_exp = SimpleResult().addHit(3).addHit(5).addHit(7);
+ EXPECT_EQUAL(true_exp, f.search_iterator("true", false));
+ EXPECT_EQUAL(true_exp, f.search_iterator("1", false));
+ EXPECT_EQUAL(true_exp, f.search_iterator("true", true));
+ EXPECT_EQUAL(true_exp, f.search_iterator("1", true));
+
+ auto false_exp = SimpleResult().addHit(1).addHit(2).addHit(4).addHit(6).addHit(8);
+ EXPECT_EQUAL(false_exp, f.search_iterator("false", false));
+ EXPECT_EQUAL(false_exp, f.search_iterator("0", false));
+ EXPECT_EQUAL(false_exp, f.search_iterator("false", true));
+ EXPECT_EQUAL(false_exp, f.search_iterator("0", true));
+}
+
void
SearchContextTest::initIntegerConfig()
{
@@ -1955,6 +2044,8 @@ SearchContextTest::Main()
TEST_DO(requireThatInvalidSearchTermGivesZeroHits());
TEST_DO(requireThatFlagAttributeHandlesTheByteRange());
TEST_DO(requireThatOutOfBoundsSearchTermGivesZeroHits());
+ TEST_DO(single_bool_attribute_search_context_handles_true_and_false_queries());
+ TEST_DO(single_bool_attribute_search_iterator_handles_true_and_false_queries());
TEST_DONE();
}
diff --git a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
index a9df188d417..842c42d4189 100644
--- a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
+++ b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
@@ -73,7 +73,7 @@ void BitVectorBenchmark::testCountSpeed1()
{
_bv[0]->invalidateCachedCount();
unsigned int cnt = _bv[0]->countTrueBits();
- assert(cnt = _bvc[0]);
+ assert(cnt == _bvc[0]);
(void) cnt;
}
diff --git a/searchlib/src/tests/common/bitvector/bitvector_test.cpp b/searchlib/src/tests/common/bitvector/bitvector_test.cpp
index d720b105671..409cc9f2725 100644
--- a/searchlib/src/tests/common/bitvector/bitvector_test.cpp
+++ b/searchlib/src/tests/common/bitvector/bitvector_test.cpp
@@ -542,15 +542,16 @@ TEST("requireThatGrowWorks")
{
vespalib::GenerationHolder g;
GrowableBitVector v(200, 200, g);
+ EXPECT_EQUAL(0u, v.countTrueBits());
- v.setBit(7);
- v.setBit(39);
- v.setBit(71);
- v.setBit(103);
-
- EXPECT_EQUAL(200u, v.size());
+ v.setBitAndMaintainCount(7);
+ v.setBitAndMaintainCount(39);
+ v.setBitAndMaintainCount(71);
+ v.setBitAndMaintainCount(103);
+ EXPECT_EQUAL(4u, v.countTrueBits());
+
+ EXPECT_EQUAL(200u, v.size());
EXPECT_EQUAL(1023u, v.capacity());
- v.invalidateCachedCount();
EXPECT_TRUE(assertBV("[7,39,71,103]", v));
EXPECT_EQUAL(4u, v.countTrueBits());
EXPECT_TRUE(v.reserve(1024));
@@ -584,6 +585,13 @@ TEST("requireThatGrowWorks")
EXPECT_EQUAL(2047u, v.capacity());
EXPECT_TRUE(assertBV("[7,39,71]", v));
EXPECT_EQUAL(3u, v.countTrueBits());
+
+ v.invalidateCachedCount();
+ EXPECT_TRUE(v.reserve(3100));
+ EXPECT_EQUAL(100u, v.size());
+ EXPECT_EQUAL(4095u, v.capacity());
+ EXPECT_EQUAL(3u, v.countTrueBits());
+
g.transferHoldLists(1);
g.trimHoldLists(2);
}
diff --git a/searchlib/src/tests/queryeval/queryeval.cpp b/searchlib/src/tests/queryeval/queryeval.cpp
index 32dc9b1fa7e..5601baa9113 100644
--- a/searchlib/src/tests/queryeval/queryeval.cpp
+++ b/searchlib/src/tests/queryeval/queryeval.cpp
@@ -346,29 +346,12 @@ public:
(void) tfmda;
return _sc->createIterator(&_tfmd, strict);
}
- const search::AttributeVector::SearchContext & getSearchContext() const { return *_sc; }
private:
search::SingleBoolAttribute _a;
search::AttributeVector::SearchContext::UP _sc;
mutable TermFieldMatchData _tfmd;
};
-TEST("test bool attribute searchcontext") {
- SimpleResult a;
- a.addHit(5).addHit(17).addHit(30);
- auto bp = std::make_unique<DummySingleValueBitNumericAttributeBlueprint>(a);
- const search::AttributeVector::SearchContext & sc = bp->getSearchContext();
- EXPECT_FALSE(sc.matches(7));
- EXPECT_TRUE(sc.matches(17));
- int32_t weight(0);
- EXPECT_FALSE(sc.matches(7, weight));
- EXPECT_EQUAL(0, weight);
- EXPECT_TRUE(sc.matches(17, weight));
- EXPECT_EQUAL(1, weight);
- EXPECT_FALSE(sc.matches(27, weight));
- EXPECT_EQUAL(0, weight);
-}
-
TEST("testAndNot") {
{
diff --git a/searchlib/src/vespa/searchlib/aggregation/hitlist.cpp b/searchlib/src/vespa/searchlib/aggregation/hitlist.cpp
index 0efe2adfaf9..2cc82d59fff 100644
--- a/searchlib/src/vespa/searchlib/aggregation/hitlist.cpp
+++ b/searchlib/src/vespa/searchlib/aggregation/hitlist.cpp
@@ -3,6 +3,7 @@
#include "hitlist.h"
#include <vespa/vespalib/objects/visit.hpp>
#include <algorithm>
+#include <stdexcept>
namespace search::aggregation {
diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
index d350b479c66..e1ab47ed434 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
@@ -104,7 +104,7 @@ private:
bool _valid;
bool valid() const override { return _valid; }
int32_t onFind(DocId docId, int32_t elemId, int32_t & weight) const override final {
- if ((elemId == 0) && _bv.testBit(docId)) {
+ if ((elemId == 0) && (_invert != _bv.testBit(docId))) {
weight = 1;
return 0;
}
@@ -113,7 +113,7 @@ private:
}
int32_t onFind(DocId docId, int32_t elemId) const override final {
- return ((elemId == 0) && _bv.testBit(docId)) ? 0 : -1;
+ return ((elemId == 0) && (_invert != _bv.testBit(docId))) ? 0 : -1;
}
public:
@@ -188,6 +188,7 @@ SingleBoolAttribute::onLoad()
_bv.extend(numDocs);
ssize_t bytesRead = attrReader.getReader().read(_bv.getStart(), _bv.sizeBytes());
_bv.invalidateCachedCount();
+ _bv.countTrueBits();
assert(bytesRead == _bv.sizeBytes());
setNumDocs(numDocs);
setCommittedDocIdLimit(numDocs);
diff --git a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp
index 3de0c1f1320..08a3847f00d 100644
--- a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp
+++ b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp
@@ -52,6 +52,7 @@ AllocatedBitVector::AllocatedBitVector(Index numberOfElements, Index capacityBit
}
setBit(size()); // Guard bit
}
+ updateCount();
}
AllocatedBitVector::AllocatedBitVector(const AllocatedBitVector & rhs) :
@@ -70,6 +71,8 @@ AllocatedBitVector::AllocatedBitVector(const BitVector & rhs, Index capacity_) :
_capacityBits = computeCapacity(_capacityBits, _alloc.size());
memcpy(_alloc.get(), rhs.getStart(), rhs.sizeBytes());
init(_alloc.get(), 0, rhs.size());
+ setBit(size());
+ updateCount();
}
//////////////////////////////////////////////////////////////////////
@@ -121,12 +124,9 @@ AllocatedBitVector::grow(Index newSize, Index newCapacity)
if (newCapacity != capacity()) {
AllocatedBitVector tbv(newSize, newCapacity, _alloc.get(), size());
if (newSize > size()) {
- tbv.clearBit(size()); // Clear old guard bit.
- }
- ret.reset(new GenerationHeldAlloc<Alloc>(_alloc));
- if (( newSize >= size()) && isValidCount()) {
- tbv.setTrueBits(countTrueBits());
+ tbv.clearBitAndMaintainCount(size()); // Clear old guard bit.
}
+ ret = std::make_unique<GenerationHeldAlloc<Alloc>>(_alloc);
swap(tbv);
} else {
if (newSize > size()) {
diff --git a/searchlib/src/vespa/searchlib/common/bitvector.cpp b/searchlib/src/vespa/searchlib/common/bitvector.cpp
index 7296842f2c1..e28ebe6682f 100644
--- a/searchlib/src/vespa/searchlib/common/bitvector.cpp
+++ b/searchlib/src/vespa/searchlib/common/bitvector.cpp
@@ -136,16 +136,6 @@ BitVector::count() const
}
BitVector::Index
-BitVector::internalCount(const Word *tarr, size_t sz)
-{
- Index count(0);
- for (size_t i(0); i < sz; i++) {
- count += Optimized::popCount(tarr[i]);
- }
- return count;
-}
-
-BitVector::Index
BitVector::countInterval(Index start, Index end) const
{
if (start >= end) return 0;
@@ -175,7 +165,7 @@ BitVector::countInterval(Index start, Index end) const
++endw;
}
if (startw < endw) {
- res += internalCount(bitValues + startw, endw - startw);
+ res += IAccelrated::getAccelrator()->populationCount(bitValues + startw, endw - startw);
}
if (partialEnd) {
res += Optimized::popCount(bitValues[endw] & ~endBits(last));
diff --git a/searchlib/src/vespa/searchlib/common/bitvector.h b/searchlib/src/vespa/searchlib/common/bitvector.h
index ee6364235e3..9671e41df24 100644
--- a/searchlib/src/vespa/searchlib/common/bitvector.h
+++ b/searchlib/src/vespa/searchlib/common/bitvector.h
@@ -29,7 +29,7 @@ public:
typedef std::unique_ptr<BitVector> UP;
BitVector(const BitVector &) = delete;
BitVector& operator = (const BitVector &) = delete;
- virtual ~BitVector() { }
+ virtual ~BitVector() = default;
bool operator == (const BitVector &right) const;
const void * getStart() const { return _words; }
void * getStart() { return _words; }
@@ -45,9 +45,9 @@ public:
}
Index countTrueBits() const {
if ( ! isValidCount()) {
- _numTrueBits = count();
+ updateCount();
}
- return _numTrueBits;
+ return _numTrueBits.load(std::memory_order_relaxed);
}
/**
@@ -189,14 +189,16 @@ public:
* should be called before calling Test/Clear/Flip methods.
*/
void invalidateCachedCount() const {
- _numTrueBits = invalidCount();
+ _numTrueBits.store(invalidCount(), std::memory_order_relaxed);
}
void swap(BitVector & rhs) {
std::swap(_words, rhs._words);
std::swap(_startOffset, rhs._startOffset);
std::swap(_sz, rhs._sz);
- std::swap(_numTrueBits, rhs._numTrueBits);
+ Index tmp = rhs._numTrueBits;
+ rhs._numTrueBits = _numTrueBits.load(std::memory_order_relaxed);
+ _numTrueBits.store(tmp, std::memory_order_relaxed);
}
/**
@@ -253,9 +255,10 @@ protected:
BitVector(void * buf, Index sz) : BitVector(buf, 0, sz) { }
BitVector() : BitVector(nullptr, 0) { }
void init(void * buf, Index start, Index end);
- void setTrueBits(Index numTrueBits) { _numTrueBits = numTrueBits; }
+ void updateCount() const { _numTrueBits.store(count(), std::memory_order_relaxed); }
+ void setTrueBits(Index numTrueBits) { _numTrueBits.store(numTrueBits, std::memory_order_relaxed); }
VESPA_DLL_LOCAL void clearIntervalNoInvalidation(Index start, Index end);
- bool isValidCount() const { return isValidCount(_numTrueBits); }
+ bool isValidCount() const { return isValidCount(_numTrueBits.load(std::memory_order_relaxed)); }
static bool isValidCount(Index v) { return v != invalidCount(); }
static Index numWords(Index bits) { return wordNum(bits + 1 + (WordLen - 1)); }
static Index numBytes(Index bits) { return numWords(bits) * sizeof(Word); }
@@ -285,16 +288,16 @@ private:
void setGuardBit() { setBit(size()); }
void incNumBits() {
if ( isValidCount() ) {
- _numTrueBits++;
+ _numTrueBits.store(_numTrueBits.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed);
}
}
void decNumBits() {
if ( isValidCount() ) {
- _numTrueBits--;
+ _numTrueBits.store(_numTrueBits.load(std::memory_order_relaxed) - 1, std::memory_order_relaxed);
+
}
}
VESPA_DLL_LOCAL void repairEnds();
- VESPA_DLL_LOCAL static Index internalCount(const Word *tarr, size_t sz);
Index count() const;
bool hasTrueBitsInternal() const;
template <typename FunctionType, typename WordConverter>
@@ -338,7 +341,7 @@ private:
func(start+pos);
start += pos + 1;
word >>= pos;
- word >>= 1;
+ word >>= 1u;
}
}
@@ -346,7 +349,7 @@ private:
Word *_words; // This is the buffer staring at Index 0
Index _startOffset; // This is the official start
Index _sz; // This is the official end.
- mutable Index _numTrueBits;
+ mutable std::atomic<Index> _numTrueBits;
protected:
friend vespalib::nbostream &
@@ -355,8 +358,6 @@ protected:
operator>>(vespalib::nbostream &in, BitVector &bv);
};
-typedef BitVector ConstBitVectorReference;
-
vespalib::nbostream &
operator<<(vespalib::nbostream &out, const BitVector &bv);
diff --git a/searchlib/src/vespa/searchlib/common/sortspec.cpp b/searchlib/src/vespa/searchlib/common/sortspec.cpp
index 694443b00ba..f6ac468b485 100644
--- a/searchlib/src/vespa/searchlib/common/sortspec.cpp
+++ b/searchlib/src/vespa/searchlib/common/sortspec.cpp
@@ -3,6 +3,7 @@
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/fastlib/text/normwordfolder.h>
#include <vespa/vespalib/text/utf8.h>
+#include <stdexcept>
namespace search {
namespace common {
diff --git a/searchlib/src/vespa/searchlib/diskindex/field_length_scanner.h b/searchlib/src/vespa/searchlib/diskindex/field_length_scanner.h
index e282a85b64f..3ef081a2820 100644
--- a/searchlib/src/vespa/searchlib/diskindex/field_length_scanner.h
+++ b/searchlib/src/vespa/searchlib/diskindex/field_length_scanner.h
@@ -5,6 +5,7 @@
#include <vector>
#include <unordered_map>
#include <limits>
+#include <cstdint>
namespace search::index { class DocIdAndFeatures; }
diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
index 4c4405fabb0..6644533550f 100644
--- a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
@@ -42,12 +42,6 @@ DocumentVisitorAdapter::visit(uint32_t lid, vespalib::ConstBufferRef buf) {
}
}
-document::Document::UP
-deserializeDocument(const vespalib::DataBuffer & uncompressed, const DocumentTypeRepo &repo) {
- vespalib::nbostream is(uncompressed.getData(), uncompressed.getDataLen());
- return std::make_unique<document::Document>(repo, is);
-}
-
}
using vespalib::nbostream;
@@ -183,7 +177,7 @@ DocumentStore::read(DocumentIdT lid, const DocumentTypeRepo &repo) const
}
Value::Result result = value.decompressed();
if ( result.second ) {
- return deserializeDocument(result.first, repo);
+ return std::make_unique<document::Document>(repo, std::move(result.first));
} else {
LOG(warning, "Summary cache for lid %u is corrupt. Invalidating and reading directly from backing store", lid);
_cache->invalidate(lid);
@@ -195,7 +189,7 @@ DocumentStore::read(DocumentIdT lid, const DocumentTypeRepo &repo) const
if ( ! value.empty() ) {
Value::Result result = value.decompressed();
assert(result.second);
- return deserializeDocument(result.first, repo);
+ return std::make_unique<document::Document>(repo, std::move(result.first));
}
return std::unique_ptr<document::Document>();
}
@@ -309,7 +303,7 @@ public:
_visitorProgress.updateProgress(progress);
}
- WrapVisitorProgress(IDocumentStoreVisitorProgress &visitProgress)
+ explicit WrapVisitorProgress(IDocumentStoreVisitorProgress &visitProgress)
: _visitorProgress(visitProgress)
{
}
@@ -369,7 +363,7 @@ DocumentStore::WrapVisitor<Visitor>::visit(uint32_t lid, const void *buffer, siz
value.set(std::move(buf), len);
}
if (! value.empty()) {
- std::shared_ptr<document::Document> doc(deserializeDocument(value.decompressed().first, _repo));
+ auto doc = std::make_shared<document::Document>(_repo, value.decompressed().first);
_visitor.visit(lid, doc);
rewrite(lid, *doc);
} else {
diff --git a/searchlib/src/vespa/searchlib/expression/aggregationrefnode.cpp b/searchlib/src/vespa/searchlib/expression/aggregationrefnode.cpp
index 4c36960c754..1962cad870a 100644
--- a/searchlib/src/vespa/searchlib/expression/aggregationrefnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/aggregationrefnode.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "aggregationrefnode.h"
#include <vespa/vespalib/util/stringfmt.h>
+#include <stdexcept>
namespace search {
namespace expression {
diff --git a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp
index eea179f67ff..5b6989b5dc9 100644
--- a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp
@@ -1,5 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "numericfunctionnode.h"
+#include <stdexcept>
namespace search::expression {
diff --git a/searchlib/src/vespa/searchlib/expression/resultnode.cpp b/searchlib/src/vespa/searchlib/expression/resultnode.cpp
index 66ac81902d8..a99ac01ce2a 100644
--- a/searchlib/src/vespa/searchlib/expression/resultnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/resultnode.cpp
@@ -3,6 +3,7 @@
#include "resultnode.h"
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/exception.h>
+#include <stdexcept>
namespace search {
namespace expression {
diff --git a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp
index fb4652a4d62..69cad65795f 100644
--- a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp
+++ b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp
@@ -11,6 +11,7 @@
#include <vespa/vespalib/objects/visit.hpp>
#include <vespa/vespalib/objects/serializer.hpp>
#include <vespa/vespalib/objects/deserializer.hpp>
+#include <stdexcept>
namespace search::expression {
diff --git a/searchlib/src/vespa/searchlib/index/postinglisthandle.h b/searchlib/src/vespa/searchlib/index/postinglisthandle.h
index 8eb42dc91fe..a9176d7cf13 100644
--- a/searchlib/src/vespa/searchlib/index/postinglisthandle.h
+++ b/searchlib/src/vespa/searchlib/index/postinglisthandle.h
@@ -3,6 +3,7 @@
#include <vespa/searchlib/index/postinglistcounts.h>
#include <memory>
+#include <cstdlib>
namespace search { class BitVector; }
namespace search::queryeval { class SearchIterator; }
diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp
index 0de200ae32c..04aa790e4cb 100644
--- a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp
+++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp
@@ -1282,7 +1282,7 @@ FakeFilterOccEGCompressed64SkipArrayIterator<doSkip>::doSeek(uint32_t docId)
s1CacheInt,
K_VALUE_FILTEROCC_L1SKIPDELTA_BITPOS, EC,
_l1SkipDocIdBitsOffset += 1 +);
- assert(docIdBitsOffset = _l1SkipDocIdBitsOffset);
+ assert(docIdBitsOffset == _l1SkipDocIdBitsOffset);
if (__builtin_expect(oDocId >= _l2SkipDocId, false)) {
// Validate L2 Skip information
assert(oDocId == _l2SkipDocId);
diff --git a/searchlib/src/vespa/searchlib/util/fileutil.cpp b/searchlib/src/vespa/searchlib/util/fileutil.cpp
index 559042a8c7a..e38763f9ba8 100644
--- a/searchlib/src/vespa/searchlib/util/fileutil.cpp
+++ b/searchlib/src/vespa/searchlib/util/fileutil.cpp
@@ -8,6 +8,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <stdexcept>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.util.fileutil");
diff --git a/searchlib/src/vespa/searchlib/util/url.cpp b/searchlib/src/vespa/searchlib/util/url.cpp
index 496a19d153f..2e1a808c493 100644
--- a/searchlib/src/vespa/searchlib/util/url.cpp
+++ b/searchlib/src/vespa/searchlib/util/url.cpp
@@ -2,6 +2,7 @@
#include "url.h"
#include <algorithm>
+#include <cstdio>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.util.url");