diff options
Diffstat (limited to 'searchlib')
29 files changed, 88 insertions, 68 deletions
diff --git a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp index c6045208a1f..185b36ec414 100644 --- a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp +++ b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp @@ -1,10 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("expglomb_test"); #include <vespa/searchlib/bitcompression/compression.h> #include <vespa/vespalib/testkit/testapp.h> #include <vector> +#include <algorithm> + +#include <vespa/log/log.h> +LOG_SETUP("expglomb_test"); using search::bitcompression::DecodeContext64; using search::bitcompression::DecodeContext64Base; diff --git a/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp b/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp index 4938d40a21f..6f09dd5c924 100644 --- a/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp +++ b/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp @@ -1,14 +1,15 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("document_remover_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchlib/memoryindex/document_remover.h> #include <vespa/searchlib/memoryindex/wordstore.h> #include <vespa/searchlib/memoryindex/i_document_remove_listener.h> #include <vespa/vespalib/test/insertion_operators.h> -#include <map> +#include <algorithm> + +#include <vespa/log/log.h> +LOG_SETUP("document_remover_test"); using namespace search; using namespace search::memoryindex; diff --git a/searchlib/src/vespa/searchlib/btree/btreetraits.h b/searchlib/src/vespa/searchlib/btree/btreetraits.h index aaeb2b28021..efa7cb4de34 100644 --- a/searchlib/src/vespa/searchlib/btree/btreetraits.h +++ b/searchlib/src/vespa/searchlib/btree/btreetraits.h @@ -2,13 +2,9 @@ #pragma once -#include <sys/types.h> +#include <cstddef> -namespace search -{ - -namespace btree -{ +namespace search::btree { template <size_t LS, size_t IS, size_t PS, bool BS> struct BTreeTraits { @@ -20,6 +16,4 @@ struct BTreeTraits { typedef BTreeTraits<16, 16, 10, true> BTreeDefaultTraits; -} // namespace search::btree -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp index 7d5aa8beeae..04909da8ea7 100644 --- a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp +++ b/searchlib/src/vespa/searchlib/common/bitvectorcache.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 "bitvectorcache.h" #include <vespa/vespalib/stllike/hash_map.hpp> +#include <algorithm> #include <vespa/log/log.h> LOG_SETUP(".searchlib.common.bitvectorcache"); diff --git a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp index f3697086147..10015bb658a 100644 --- a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp +++ b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp @@ -4,6 +4,7 @@ #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/guard.h> #include <cassert> +#include <algorithm> #include <vespa/log/log.h> LOG_SETUP(".indexmetainfo"); diff --git a/searchlib/src/vespa/searchlib/common/location.cpp b/searchlib/src/vespa/searchlib/common/location.cpp index 31af111b2bf..cda3973b311 100644 --- a/searchlib/src/vespa/searchlib/common/location.cpp +++ b/searchlib/src/vespa/searchlib/common/location.cpp @@ -3,6 +3,7 @@ // Copyright (C) 2003 Overture Services Norway AS #include "location.h" +#include <limits> namespace search::common { diff --git a/searchlib/src/vespa/searchlib/common/rankedhit.h b/searchlib/src/vespa/searchlib/common/rankedhit.h index d1feb5e3282..bd66f884a08 100644 --- a/searchlib/src/vespa/searchlib/common/rankedhit.h +++ b/searchlib/src/vespa/searchlib/common/rankedhit.h @@ -5,8 +5,8 @@ #pragma once #include "hitrank.h" -#include <sys/types.h> -#include <stdint.h> +#include <cstdint> +#include <cstddef> namespace search { diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp b/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp index 2bf2fc751d3..f8325c3cd7d 100644 --- a/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp +++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp @@ -1,6 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "tunefileinfo.h" +#include "tunefileinfo.hpp" namespace search { diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.h b/searchlib/src/vespa/searchlib/common/tunefileinfo.h index 2dd27142dc6..223dcdbc7f1 100644 --- a/searchlib/src/vespa/searchlib/common/tunefileinfo.h +++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.h @@ -2,9 +2,6 @@ #pragma once -#include <sys/mman.h> -#include <linux/mman.h> -#include <fcntl.h> #include <memory> namespace search { @@ -123,26 +120,7 @@ public: template <typename TuneControlConfig, typename MMapConfig> void - setFromConfig(const enum TuneControlConfig::Io & tuneControlConfig, const MMapConfig & mmapFlags) { - switch ( tuneControlConfig) { - case TuneControlConfig::NORMAL: _tuneControl = NORMAL; break; - case TuneControlConfig::DIRECTIO: _tuneControl = DIRECTIO; break; - case TuneControlConfig::MMAP: _tuneControl = MMAP; break; - default: _tuneControl = NORMAL; break; - } - for (size_t i(0), m(mmapFlags.options.size()); i < m; i++) { - switch (mmapFlags.options[i]) { - case MMapConfig::MLOCK: _mmapFlags |= MAP_LOCKED; break; - case MMapConfig::POPULATE: _mmapFlags |= MAP_POPULATE; break; - case MMapConfig::HUGETLB: _mmapFlags |= MAP_HUGETLB; break; - } - } - switch (mmapFlags.advise) { - case MMapConfig::NORMAL: setAdvise(POSIX_FADV_NORMAL); break; - case MMapConfig::RANDOM: setAdvise(POSIX_FADV_RANDOM); break; - case MMapConfig::SEQUENTIAL: setAdvise(POSIX_FADV_SEQUENTIAL); break; - } - } + setFromConfig(const enum TuneControlConfig::Io & tuneControlConfig, const MMapConfig & mmapFlags); bool operator==(const TuneFileRandRead &rhs) const { return (_tuneControl == rhs._tuneControl) && (_mmapFlags == rhs._mmapFlags); diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp b/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp new file mode 100644 index 00000000000..22d89d904d2 --- /dev/null +++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp @@ -0,0 +1,35 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "tunefileinfo.h" +#include <sys/mman.h> +#include <fcntl.h> + +namespace search { + +template <typename TuneControlConfig, typename MMapConfig> +void +TuneFileRandRead::setFromConfig(const enum TuneControlConfig::Io & tuneControlConfig, const MMapConfig & mmapFlags) { + switch ( tuneControlConfig) { + case TuneControlConfig::NORMAL: _tuneControl = NORMAL; break; + case TuneControlConfig::DIRECTIO: _tuneControl = DIRECTIO; break; + case TuneControlConfig::MMAP: _tuneControl = MMAP; break; + default: _tuneControl = NORMAL; break; + } + for (size_t i(0), m(mmapFlags.options.size()); i < m; i++) { + switch (mmapFlags.options[i]) { + case MMapConfig::MLOCK: _mmapFlags |= MAP_LOCKED; break; + case MMapConfig::POPULATE: _mmapFlags |= MAP_POPULATE; break; + case MMapConfig::HUGETLB: _mmapFlags |= MAP_HUGETLB; break; + } + } + switch (mmapFlags.advise) { + case MMapConfig::NORMAL: setAdvise(POSIX_FADV_NORMAL); break; + case MMapConfig::RANDOM: setAdvise(POSIX_FADV_RANDOM); break; + case MMapConfig::SEQUENTIAL: setAdvise(POSIX_FADV_SEQUENTIAL); break; + } +} + +} + diff --git a/searchlib/src/vespa/searchlib/datastore/array_store.hpp b/searchlib/src/vespa/searchlib/datastore/array_store.hpp index 8478c22903f..cd45df90899 100644 --- a/searchlib/src/vespa/searchlib/datastore/array_store.hpp +++ b/searchlib/src/vespa/searchlib/datastore/array_store.hpp @@ -5,6 +5,7 @@ #include "array_store.h" #include "datastore.hpp" #include <atomic> +#include <algorithm> namespace search::datastore { diff --git a/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp b/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp index 5eca3719002..6e77b267818 100644 --- a/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp +++ b/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp @@ -2,9 +2,15 @@ #include "buffer_type.h" #include <algorithm> +#include <cassert> namespace search::datastore { +void +BufferTypeBase::CleanContext::extraBytesCleaned(uint64_t value) { + assert(_extraBytes >= value); + _extraBytes -= value; +} BufferTypeBase::BufferTypeBase(uint32_t clusterSize, uint32_t minClusters, uint32_t maxClusters, diff --git a/searchlib/src/vespa/searchlib/datastore/buffer_type.h b/searchlib/src/vespa/searchlib/datastore/buffer_type.h index 92dcbcc9e8d..6fc5c4ab288 100644 --- a/searchlib/src/vespa/searchlib/datastore/buffer_type.h +++ b/searchlib/src/vespa/searchlib/datastore/buffer_type.h @@ -2,9 +2,8 @@ #pragma once -#include <cassert> #include <cstdint> -#include <sys/types.h> +#include <cstddef> namespace search::datastore { @@ -33,10 +32,7 @@ public: uint64_t &_extraBytes; public: CleanContext(uint64_t &extraBytes) : _extraBytes(extraBytes) {} - void extraBytesCleaned(uint64_t value) { - assert(_extraBytes >= value); - _extraBytes -= value; - } + void extraBytesCleaned(uint64_t value); }; BufferTypeBase(const BufferTypeBase &rhs) = delete; diff --git a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp index d344c79d50e..ba0c8e05d77 100644 --- a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp +++ b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp @@ -2,6 +2,7 @@ #include "datastore.h" #include <vespa/vespalib/util/array.hpp> +#include <limits> using vespalib::GenerationHeldBase; diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h index 1d47d3c0b5a..8141a16c137 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h @@ -4,6 +4,7 @@ #include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/vespalib/util/array.h> #include <vespa/vespalib/stllike/string.h> +#include <limits> namespace search::diskindex { diff --git a/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp b/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp index 2b7b49aa955..3bb1481969a 100644 --- a/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp +++ b/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp @@ -4,9 +4,9 @@ #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/data/databuffer.h> +#include <algorithm> -namespace search { -namespace docstore { +namespace search::docstore { using document::BucketId; using vespalib::makeTask; @@ -85,4 +85,3 @@ StoreByBucket::drain(IWrite & drainer) } } -} diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp index c68aa00994f..22a16947b67 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp @@ -6,6 +6,7 @@ #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/data/databuffer.h> #include <vespa/document/util/compressor.h> +#include <algorithm> namespace search::docstore { diff --git a/searchlib/src/vespa/searchlib/features/array_parser.h b/searchlib/src/vespa/searchlib/features/array_parser.h index 406138c2a18..53247eabe2c 100644 --- a/searchlib/src/vespa/searchlib/features/array_parser.h +++ b/searchlib/src/vespa/searchlib/features/array_parser.h @@ -4,8 +4,7 @@ #include <vespa/vespalib/stllike/string.h> -namespace search { -namespace features { +namespace search::features { /** * Utility for parsing a string representation of an array with values (numeric or string) @@ -45,5 +44,4 @@ public: static void parsePartial(const vespalib::string &input, OutputType &output); }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/array_parser.hpp b/searchlib/src/vespa/searchlib/features/array_parser.hpp index 7462427cf74..613fa9ec13e 100644 --- a/searchlib/src/vespa/searchlib/features/array_parser.hpp +++ b/searchlib/src/vespa/searchlib/features/array_parser.hpp @@ -7,9 +7,9 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/stringfmt.h> #include <vector> +#include <algorithm> -namespace search { -namespace features { +namespace search::features { template <typename OutputType> void @@ -92,5 +92,4 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output) template void ArrayParser::parse(const vespalib::string &input, std::vector<int> &); -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/utils.h b/searchlib/src/vespa/searchlib/features/utils.h index 501dff17b41..57f4c83f6a9 100644 --- a/searchlib/src/vespa/searchlib/features/utils.h +++ b/searchlib/src/vespa/searchlib/features/utils.h @@ -9,6 +9,7 @@ #include <vespa/searchlib/fef/itermfielddata.h> #include <vespa/searchlib/common/feature.h> #include <vespa/vespalib/util/string_hash.h> +#include <limits> namespace search::features::util { diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp index 4e971bcc484..493b49be0b0 100644 --- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp +++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp @@ -3,6 +3,7 @@ #include "indexproperties.h" #include "properties.h" #include <vespa/vespalib/locale/c.h> +#include <limits> namespace search::fef::indexproperties { diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.cpp b/searchlib/src/vespa/searchlib/fef/rank_program.cpp index 431ff798c83..fa4582d46b7 100644 --- a/searchlib/src/vespa/searchlib/fef/rank_program.cpp +++ b/searchlib/src/vespa/searchlib/fef/rank_program.cpp @@ -3,6 +3,7 @@ #include "rank_program.h" #include "featureoverrider.h" #include <vespa/vespalib/locale/c.h> +#include <algorithm> using vespalib::Stash; diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp index 7cfc6afa72d..7ff5dcf8b6c 100644 --- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp +++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.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 "termfieldmatchdata.h" +#include <limits> namespace search::fef { diff --git a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp index a382a2cd6ee..97cb829e30c 100644 --- a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp +++ b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp @@ -1,9 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "termmatchdatamerger.h" +#include <algorithm> -namespace search { -namespace fef { +namespace search::fef { TermMatchDataMerger::TermMatchDataMerger(const Inputs &allinputs, const TermFieldMatchDataArray &outputs) @@ -70,5 +70,4 @@ TermMatchDataMerger::merge(uint32_t docid, } } -} // namespace fef -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/index/dictionaryfile.h b/searchlib/src/vespa/searchlib/index/dictionaryfile.h index 574f5bcf56b..2f673c258f3 100644 --- a/searchlib/src/vespa/searchlib/index/dictionaryfile.h +++ b/searchlib/src/vespa/searchlib/index/dictionaryfile.h @@ -5,6 +5,7 @@ #include "postinglisthandle.h" #include "postinglistcountfile.h" #include <vespa/searchlib/common/tunefileinfo.h> +#include <limits> class FastOS_FileInterface; diff --git a/searchlib/src/vespa/searchlib/query/queryterm.cpp b/searchlib/src/vespa/searchlib/query/queryterm.cpp index 70cbcd37ee0..d47d942dc10 100644 --- a/searchlib/src/vespa/searchlib/query/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/query/queryterm.cpp @@ -1,4 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "queryterm.h" #include "base.h" #include <vespa/vespalib/objects/visit.h> @@ -6,6 +7,7 @@ #include <vespa/vespalib/util/classname.h> #include <vespa/vespalib/locale/c.h> #include <cmath> +#include <limits> namespace { diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp b/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp index 0a520034e7f..c9ab167868a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp @@ -3,6 +3,7 @@ #include "predicate_search.h" #include <vespa/searchlib/fef/termfieldmatchdata.h> #include <vespa/searchlib/fef/termfieldmatchdataarray.h> +#include <algorithm> using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataArray; diff --git a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp index 3a92169d43e..f8af7700640 100644 --- a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp @@ -3,9 +3,9 @@ #include "unpackinfo.h" #include <vespa/vespalib/stllike/asciistream.h> #include <cassert> +#include <algorithm> -namespace search { -namespace queryeval { +namespace search::queryeval { UnpackInfo::UnpackInfo() : _size(0) @@ -101,5 +101,4 @@ UnpackInfo::toString() const return os.str(); } -} // namespace queryeval -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/initrange.cpp b/searchlib/src/vespa/searchlib/test/initrange.cpp index 7d125ea5cdd..2292a8e775e 100644 --- a/searchlib/src/vespa/searchlib/test/initrange.cpp +++ b/searchlib/src/vespa/searchlib/test/initrange.cpp @@ -3,9 +3,9 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/searchlib/queryeval/emptysearch.h> #include <vespa/searchlib/queryeval/truesearch.h> +#include <algorithm> -namespace search { -namespace test { +namespace search::test { using namespace search::queryeval; using std::make_unique; @@ -184,4 +184,3 @@ InitRangeVerifier::searchStrict(SearchIterator & it, Range range) } } -} |