diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-02-05 23:39:21 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-02-06 17:57:24 +0100 |
commit | 65dcaa714247b95459495338f044e89446d9a986 (patch) | |
tree | 8b897a6f4a2a852d1fed11fa6f70dbfabb008e1e | |
parent | 3655644bd1761ee3190769ea59abc0263cfb61dd (diff) |
Optimize includes.
31 files changed, 172 insertions, 249 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index bffedd30a9f..43738438fc6 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -16,6 +16,7 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/searchcore/proton/server/itlssyncer.h> #include <vespa/searchcore/proton/common/hw_info.h> +#include <vespa/searchlib/query/queryterm.h> #include <vespa/log/log.h> LOG_SETUP("documentmetastore_test"); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index ffda6b07480..5152f0d0be6 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -16,6 +16,7 @@ #include <vespa/searchcore/proton/bucketdb/splitbucketsession.h> #include <vespa/searchlib/util/bufferwriter.h> #include <vespa/searchlib/common/rcuvector.hpp> +#include <vespa/searchlib/query/queryterm.h> #include <vespa/fastos/file.h> @@ -622,8 +623,7 @@ DocumentMetaStore::move(DocId fromLid, DocId toLid) } void -DocumentMetaStore::removeBatch(const std::vector<search::DocumentIdT> &lidsToRemove, - const uint32_t docIdLimit) +DocumentMetaStore::removeBatch(const std::vector<DocId> &lidsToRemove, const uint32_t docIdLimit) { for (const auto &lid : lidsToRemove) { assert(lid > 0 && lid < docIdLimit); @@ -750,7 +750,7 @@ DocumentMetaStore::createBlackListBlueprint() const } AttributeVector::SearchContext::UP -DocumentMetaStore::getSearch(search::QueryTermSimple::UP qTerm, const AttributeVector::SearchContext::Params &) const +DocumentMetaStore::getSearch(std::unique_ptr<search::QueryTermSimple> qTerm, const AttributeVector::SearchContext::Params &) const { return AttributeVector::SearchContext::UP (new documentmetastore::SearchContext(std::move(qTerm), *this)); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h index 389c4c7ec27..0b4272da7a9 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h @@ -212,7 +212,7 @@ public: * Implements search::AttributeVector */ SearchContext::UP - getSearch(search::QueryTermSimple::UP qTerm, + getSearch(std::unique_ptr<search::QueryTermSimple> qTerm, const search::AttributeVector::SearchContext::Params & params) const override; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp index 0abec2b44ca..37735d42e8c 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "lid_allocator.h" - +#include <vespa/searchlib/query/queryterm.h> #include <vespa/log/log.h> LOG_SETUP(".proton.documentmetastore.lid_allocator"); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp index 7e4f3067d4e..d03a5a14743 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp @@ -1,11 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.documentmetastore.search_context"); - #include "search_context.h" #include <vespa/searchlib/attribute/attributeiterators.h> +#include <vespa/searchlib/query/queryterm.h> #include <vespa/vespalib/util/exceptions.h> using document::GlobalId; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h index 6a2e6f2045e..570e299dd14 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h @@ -20,18 +20,17 @@ private: bool _isWord; document::GlobalId _gid; - virtual unsigned int approximateHits() const; - virtual bool onCmp(DocId docId, int32_t &weight) const; - virtual bool onCmp(DocId docId) const; + unsigned int approximateHits() const override; + bool onCmp(DocId docId, int32_t &weight) const override; + bool onCmp(DocId docId) const override; - virtual search::queryeval::SearchIterator::UP - createIterator(search::fef::TermFieldMatchData *matchData, - bool strict); + search::queryeval::SearchIterator::UP + createIterator(search::fef::TermFieldMatchData *matchData, bool strict) override; const DocumentMetaStore &getStore() const; public: - SearchContext(search::QueryTermSimple::UP qTerm, + SearchContext(std::unique_ptr<search::QueryTermSimple> qTerm, const DocumentMetaStore &toBeSearched); }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index f52739cf17c..18cdc0f26b3 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -9,8 +9,9 @@ #include <vespa/vespalib/util/closure.h> #include <vespa/vespalib/util/thread_bundle.h> #include <vespa/searchcore/grouping/groupingmanager.h> -#include <vespa/log/log.h> +#include <vespa/searchlib/common/bitvector.h> +#include <vespa/log/log.h> LOG_SETUP(".proton.matching.match_thread"); namespace proton { @@ -18,7 +19,6 @@ namespace matching { using search::queryeval::OptimizedAndNotForBlackListing; using search::queryeval::SearchIterator; -using search::fef::TermFieldHandle; using search::fef::MatchData; using search::fef::RankProgram; using search::fef::FeatureResolver; diff --git a/searchlib/src/tests/attribute/attributesearcher.h b/searchlib/src/tests/attribute/attributesearcher.h index 8f9618b27db..e6db62ca0e6 100644 --- a/searchlib/src/tests/attribute/attributesearcher.h +++ b/searchlib/src/tests/attribute/attributesearcher.h @@ -8,6 +8,7 @@ #include <vespa/searchlib/queryeval/hitcollector.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/compress.h> +#include <vespa/searchlib/parsequery/parse.h> namespace search { diff --git a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp index 8b65b0adaa6..df0a406aebb 100644 --- a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp +++ b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp @@ -19,6 +19,8 @@ #include <vespa/searchlib/util/randomgenerator.h> #include <vespa/searchlib/util/bufferwriter.h> #include <vespa/searchlib/attribute/attributememoryfilebufferwriter.h> +#include <vespa/searchlib/fef/termfieldmatchdata.h> +#include <vespa/searchlib/parsequery/parse.h> #include <vespa/searchlib/attribute/attributevector.hpp> diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp index 285582ea7ea..b8285066184 100644 --- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp +++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp @@ -14,6 +14,7 @@ #include <vespa/searchlib/attribute/enumstore.hpp> #include <vespa/searchlib/attribute/attributevector.hpp> #include <vespa/vespalib/util/compress.h> +#include <vespa/searchlib/fef/termfieldmatchdata.h> #include <vespa/fastos/file.h> #include <iostream> #include <vespa/log/log.h> diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp index 41d1deda63f..138e406c988 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp @@ -10,10 +10,12 @@ #include <vespa/searchlib/fef/matchdata.h> #include <vespa/searchlib/fef/termfieldmatchdataarray.h> #include <vespa/searchlib/queryeval/hitcollector.h> +#include <vespa/searchlib/queryeval/emptysearch.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/compress.h> #include <vespa/searchlib/test/searchiteratorverifier.h> - +#include <vespa/searchlib/query/queryterm.h> +#include <vespa/searchlib/parsequery/parse.h> #include <vespa/searchlib/attribute/attributevector.hpp> #include <vespa/log/log.h> diff --git a/searchlib/src/vespa/searchlib/attribute/attributeiterators.cpp b/searchlib/src/vespa/searchlib/attribute/attributeiterators.cpp index 0d756eea4a9..4b8c1ac911d 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.cpp @@ -25,6 +25,13 @@ AttributeIteratorBase::visitMembers(vespalib::ObjectVisitor &visitor) const visit(visitor, "tfmd.docId", _matchData->getDocId()); } +FilterAttributeIterator::FilterAttributeIterator(fef::TermFieldMatchData * matchData, uint32_t docIdLimit) + : AttributeIteratorBase(matchData), + _docIdLimit(docIdLimit) +{ + _matchPosition->setElementWeight(1); +} + void FilterAttributeIterator::visitMembers(vespalib::ObjectVisitor &visitor) const { diff --git a/searchlib/src/vespa/searchlib/attribute/attributeiterators.h b/searchlib/src/vespa/searchlib/attribute/attributeiterators.h index f6603cd8c87..a05dbd5430e 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.h +++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.h @@ -2,17 +2,17 @@ #pragma once -#include "dociditerator.h" -#include "attributevector.h" -#include <vespa/searchlib/fef/termfieldmatchdata.h> -#include <vespa/searchlib/fef/termfieldmatchdataposition.h> #include <vespa/searchlib/queryeval/searchiterator.h> #include <vespa/searchlib/btree/btreenode.h> #include <vespa/searchlib/btree/btreeiterator.h> -#include <vespa/vespalib/objects/visit.h> namespace search { +namespace fef { + class TermFieldMatchData; + class TermFieldMatchDataPosition; +} + /** * Abstract superclass for all attribute iterators with convenience function * for getting the type of the iterator (used for testing). @@ -58,12 +58,7 @@ protected: class FilterAttributeIterator : public AttributeIteratorBase { public: - FilterAttributeIterator(fef::TermFieldMatchData * matchData, uint32_t docIdLimit) - : AttributeIteratorBase(matchData), - _docIdLimit(docIdLimit) - { - _matchPosition->setElementWeight(1); - } + FilterAttributeIterator(fef::TermFieldMatchData * matchData, uint32_t docIdLimit); protected: void visitMembers(vespalib::ObjectVisitor &visitor) const override; void doUnpack(uint32_t docId) override; @@ -146,55 +141,6 @@ public: { } }; - -template <typename SC> -void -AttributeIteratorT<SC>::doSeek(uint32_t docId) -{ - if (__builtin_expect(docId >= _docIdLimit, false)) { - setAtEnd(); - } else if (_searchContext.cmp(docId, _weight)) { - setDocId(docId); - } -} - -template <typename SC> -void -FilterAttributeIteratorT<SC>::doSeek(uint32_t docId) -{ - if (__builtin_expect(docId >= _docIdLimit, false)) { - setAtEnd(); - } else if (_searchContext.cmp(docId)) { - setDocId(docId); - } -} - -template <typename SC> -void -AttributeIteratorStrict<SC>::doSeek(uint32_t docId) -{ - for (uint32_t nextId = docId; nextId < _docIdLimit; ++nextId) { - if (_searchContext.cmp(nextId, _weight)) { - setDocId(nextId); - return; - } - } - setAtEnd(); -} - -template <typename SC> -void -FilterAttributeIteratorStrict<SC>::doSeek(uint32_t docId) -{ - for (uint32_t nextId = docId; nextId < _docIdLimit; ++nextId) { - if (_searchContext.cmp(nextId)) { - setDocId(nextId); - return; - } - } - setAtEnd(); -} - /** * This class acts as an iterator over documents that are results for * the subquery represented by the search context object associated @@ -254,20 +200,11 @@ private: return _postingInfoValid ? &_postingInfo : NULL; } - void initRange(uint32_t begin, uint32_t end) override { - AttributePostingListIterator::initRange(begin, end); - _iterator.lower_bound(begin); - if (!_iterator.valid() || isAtEnd(_iterator.getKey())) { - setAtEnd(); - } else { - setDocId(_iterator.getKey()); - } - } + void initRange(uint32_t begin, uint32_t end) override; public: // Note: iterator constructor argument is destroyed - AttributePostingListIteratorT(PL &iterator, - bool hasWeight, + AttributePostingListIteratorT(PL &iterator, bool hasWeight, fef::TermFieldMatchData *matchData); }; @@ -291,16 +228,8 @@ private: const queryeval::PostingInfo * getPostingInfo() const override { return _postingInfoValid ? &_postingInfo : NULL; } - - void initRange(uint32_t begin, uint32_t end) override { - FilterAttributePostingListIterator::initRange(begin, end); - _iterator.lower_bound(begin); - if (!_iterator.valid() || isAtEnd(_iterator.getKey())) { - setAtEnd(); - } else { - setDocId(_iterator.getKey()); - } - } + + void initRange(uint32_t begin, uint32_t end) override; public: // Note: iterator constructor argument is destroyed @@ -321,105 +250,6 @@ getWeight() return 1; // default weight 1 for single value attributes } -template <> -void -AttributePostingListIteratorT<btree:: -BTreeConstIterator<uint32_t, - btree::BTreeNoLeafData, - btree::NoAggregated, - std::less<uint32_t>, - btree::BTreeDefaultTraits> >:: -doUnpack(uint32_t docId); - - -template <> -void -AttributePostingListIteratorT<btree:: -BTreeConstIterator<uint32_t, - int32_t, - btree::MinMaxAggregated, - std::less<uint32_t>, - btree::BTreeDefaultTraits> >:: -doUnpack(uint32_t docId); - - -template <> -void -AttributePostingListIteratorT<InnerAttributePostingListIterator>:: -setupPostingInfo(); - - -template <> -void -AttributePostingListIteratorT<WeightedInnerAttributePostingListIterator>:: -setupPostingInfo(); - - -template <> -void -AttributePostingListIteratorT<DocIdMinMaxIterator<AttributePosting> >:: -setupPostingInfo(); - - -template <> -void -AttributePostingListIteratorT<DocIdMinMaxIterator<AttributeWeightPosting> >:: -setupPostingInfo(); - - -template <> -void -FilterAttributePostingListIteratorT<InnerAttributePostingListIterator>:: -setupPostingInfo(); - - -template <> -void -FilterAttributePostingListIteratorT<WeightedInnerAttributePostingListIterator>:: -setupPostingInfo(); - - -template <> -void -FilterAttributePostingListIteratorT<DocIdMinMaxIterator<AttributePosting> >:: -setupPostingInfo(); - - -template <> -void -FilterAttributePostingListIteratorT<DocIdMinMaxIterator<AttributeWeightPosting> >:: -setupPostingInfo(); - - -template <typename PL> -AttributePostingListIteratorT<PL>:: -AttributePostingListIteratorT(PL &iterator, - bool hasWeight, - fef::TermFieldMatchData *matchData) - : AttributePostingListIterator(hasWeight, matchData), - _iterator(), - _postingInfo(1, 1), - _postingInfoValid(false) -{ - _iterator.swap(iterator); - setupPostingInfo(); -} - - -template <typename PL> -FilterAttributePostingListIteratorT<PL>:: -FilterAttributePostingListIteratorT(PL &iterator, fef::TermFieldMatchData *matchData) - : FilterAttributePostingListIterator(matchData), - _iterator(), - _postingInfo(1, 1), - _postingInfoValid(false) -{ - _iterator.swap(iterator); - setupPostingInfo(); - _matchPosition->setElementWeight(1); -} - - /** * This class acts as an iterator over a flag attribute. */ diff --git a/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp b/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp index e6c1359ab14..f14be8e20cc 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp +++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp @@ -5,12 +5,65 @@ #include "attributeiterators.h" #include <vespa/searchlib/btree/btreenode.hpp> #include <vespa/searchlib/btree/btreeiterator.hpp> +#include <vespa/searchlib/fef/termfieldmatchdata.h> +#include <vespa/searchlib/fef/termfieldmatchdataposition.h> #include <vespa/searchlib/query/queryterm.h> #include <vespa/searchlib/common/bitvector.h> +#include <vespa/vespalib/objects/visit.h> namespace search { template <typename PL> +AttributePostingListIteratorT<PL>:: +AttributePostingListIteratorT(PL &iterator, + bool hasWeight, + fef::TermFieldMatchData *matchData) + : AttributePostingListIterator(hasWeight, matchData), + _iterator(), + _postingInfo(1, 1), + _postingInfoValid(false) +{ + _iterator.swap(iterator); + setupPostingInfo(); +} + +template <typename PL> +void AttributePostingListIteratorT<PL>::initRange(uint32_t begin, uint32_t end) { + AttributePostingListIterator::initRange(begin, end); + _iterator.lower_bound(begin); + if (!_iterator.valid() || isAtEnd(_iterator.getKey())) { + setAtEnd(); + } else { + setDocId(_iterator.getKey()); + } +} + + +template <typename PL> +FilterAttributePostingListIteratorT<PL>:: +FilterAttributePostingListIteratorT(PL &iterator, fef::TermFieldMatchData *matchData) + : FilterAttributePostingListIterator(matchData), + _iterator(), + _postingInfo(1, 1), + _postingInfoValid(false) +{ + _iterator.swap(iterator); + setupPostingInfo(); + _matchPosition->setElementWeight(1); +} + +template <typename PL> +void FilterAttributePostingListIteratorT<PL>::initRange(uint32_t begin, uint32_t end) { + FilterAttributePostingListIterator::initRange(begin, end); + _iterator.lower_bound(begin); + if (!_iterator.valid() || isAtEnd(_iterator.getKey())) { + setAtEnd(); + } else { + setDocId(_iterator.getKey()); + } +} + +template <typename PL> void AttributePostingListIteratorT<PL>::doSeek(uint32_t docId) { @@ -144,5 +197,52 @@ FlagAttributeIteratorT<SC>::doSeek(uint32_t docId) } } +template <typename SC> +void +AttributeIteratorT<SC>::doSeek(uint32_t docId) +{ + if (__builtin_expect(docId >= _docIdLimit, false)) { + setAtEnd(); + } else if (_searchContext.cmp(docId, _weight)) { + setDocId(docId); + } +} + +template <typename SC> +void +FilterAttributeIteratorT<SC>::doSeek(uint32_t docId) +{ + if (__builtin_expect(docId >= _docIdLimit, false)) { + setAtEnd(); + } else if (_searchContext.cmp(docId)) { + setDocId(docId); + } +} + +template <typename SC> +void +AttributeIteratorStrict<SC>::doSeek(uint32_t docId) +{ + for (uint32_t nextId = docId; nextId < _docIdLimit; ++nextId) { + if (_searchContext.cmp(nextId, _weight)) { + setDocId(nextId); + return; + } + } + setAtEnd(); +} + +template <typename SC> +void +FilterAttributeIteratorStrict<SC>::doSeek(uint32_t docId) +{ + for (uint32_t nextId = docId; nextId < _docIdLimit; ++nextId) { + if (_searchContext.cmp(nextId)) { + setDocId(nextId); + return; + } + } + setAtEnd(); +} } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/flagattribute.h b/searchlib/src/vespa/searchlib/attribute/flagattribute.h index 389334737cf..83f452ab342 100644 --- a/searchlib/src/vespa/searchlib/attribute/flagattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/flagattribute.h @@ -2,8 +2,6 @@ #pragma once #include "multinumericattribute.h" -#include <vespa/searchlib/queryeval/searchiterator.h> -#include <vespa/searchlib/common/rcuvector.h> namespace search { @@ -20,7 +18,7 @@ private: class SearchContext : public BaseSC { public: typedef FlagAttributeT<B> Attribute; - SearchContext(QueryTermSimple::UP qTerm, const FlagAttributeT<B> & toBeSearched); + SearchContext(std::unique_ptr<QueryTermSimple> qTerm, const FlagAttributeT<B> & toBeSearched); std::unique_ptr<queryeval::SearchIterator> createIterator(fef::TermFieldMatchData * matchData, bool strict) override; @@ -34,7 +32,7 @@ private: bool onLoad() override; bool onLoadEnumerated(ReaderBase &attrReader) override; AttributeVector::SearchContext::UP - getSearch(QueryTermSimple::UP term, const AttributeVector::SearchContext::Params & params) const override; + getSearch(std::unique_ptr<QueryTermSimple> term, const AttributeVector::SearchContext::Params & params) const override; void clearOldValues(DocId doc) override; void setNewValues(DocId doc, const std::vector<typename B::WType> & values) override; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h index ce3480d773b..3189b452476 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h @@ -2,14 +2,10 @@ #pragma once -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/floatbase.h> -#include <vespa/searchlib/attribute/multivalueattribute.h> -#include <vespa/searchlib/attribute/attributeiterators.h> -#include <vespa/searchlib/query/query.h> -#include <vespa/searchlib/queryeval/emptysearch.h> +#include "integerbase.h" +#include "floatbase.h" +#include "multivalueattribute.h" #include <limits> -#include <string> namespace search { @@ -84,7 +80,7 @@ public: bool valid() const override; public: - SetSearchContext(QueryTermSimple::UP qTerm, const NumericAttribute & toBeSearched); + SetSearchContext(std::unique_ptr<QueryTermSimple> qTerm, const NumericAttribute & toBeSearched); Int64Range getAsIntegerTerm() const override; @@ -133,7 +129,7 @@ public: bool valid() const override; public: - ArraySearchContext(QueryTermSimple::UP qTerm, const NumericAttribute & toBeSearched); + ArraySearchContext(std::unique_ptr<QueryTermSimple> qTerm, const NumericAttribute & toBeSearched); bool cmp(DocId doc, int32_t & weight) const { uint32_t hitCount = 0; MultiValueArrayRef values(_toBeSearched._mvMapping.get(doc)); @@ -176,7 +172,7 @@ public: virtual bool onLoadEnumerated(ReaderBase &attrReader); AttributeVector::SearchContext::UP - getSearch(QueryTermSimple::UP term, const AttributeVector::SearchContext::Params & params) const override; + getSearch(std::unique_ptr<QueryTermSimple> term, const AttributeVector::SearchContext::Params & params) const override; virtual void clearOldValues(DocId doc); virtual void setNewValues(DocId doc, const std::vector<WType> & values); diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp index 1e865d95f2e..f287be4db29 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp @@ -5,11 +5,12 @@ #include "multivalueattribute.hpp" #include "attributevector.hpp" #include "attributeiterators.hpp" -#include <vespa/searchlib/util/fileutil.h> -#include <vespa/fastlib/io/bufferedfile.h> #include "multinumericattributesaver.h" #include "load_utils.h" #include "primitivereader.h" +#include <vespa/searchlib/queryeval/emptysearch.h> +#include <vespa/searchlib/util/fileutil.h> +#include <vespa/fastlib/io/bufferedfile.h> namespace search { @@ -211,8 +212,7 @@ std::unique_ptr<queryeval::SearchIterator> MultiValueNumericAttribute<B, M>::SetSearchContext::createFilterIterator(fef::TermFieldMatchData * matchData, bool strict) { if (!valid()) { - return queryeval::SearchIterator::UP( - new queryeval::EmptySearch()); + return queryeval::SearchIterator::UP(new queryeval::EmptySearch()); } if (getIsFilter()) { return queryeval::SearchIterator::UP diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h index 8c2678e096e..05729283fce 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h @@ -3,8 +3,6 @@ #pragma once #include "multienumattribute.h" -#include "attributeiterators.h" -#include <vespa/searchlib/queryeval/emptysearch.h> #include "numericbase.h" #include "primitivereader.h" diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp index 9255a23984d..ddd749df279 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp @@ -8,6 +8,7 @@ #include <vespa/searchlib/util/fileutil.hpp> #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/searchlib/query/queryterm.h> +#include <vespa/searchlib/queryeval/emptysearch.h> namespace search { @@ -161,8 +162,7 @@ std::unique_ptr<queryeval::SearchIterator> MultiValueNumericEnumAttribute<B, M>::SetSearchContext::createFilterIterator(fef::TermFieldMatchData * matchData, bool strict) { if (!valid()) { - return queryeval::SearchIterator::UP( - new queryeval::EmptySearch()); + return queryeval::SearchIterator::UP(new queryeval::EmptySearch()); } if (getIsFilter()) { return queryeval::SearchIterator::UP diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h index af3b2823fd8..2379fbe1f87 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h @@ -4,10 +4,7 @@ #include "integerbase.h" #include "floatbase.h" -#include "attributeiterators.h" #include <vespa/searchlib/common/rcuvector.h> -#include <vespa/searchlib/query/query.h> -#include <vespa/searchlib/queryeval/emptysearch.h> #include <limits> namespace search { @@ -55,7 +52,7 @@ private: bool valid() const override; public: - SingleSearchContext(QueryTermSimple::UP qTerm, const NumericAttribute & toBeSearched); + SingleSearchContext(std::unique_ptr<QueryTermSimple> qTerm, const NumericAttribute & toBeSearched); bool cmp(DocId docId, int32_t & weight) const { const T v = _data[docId]; weight = 1; @@ -107,7 +104,7 @@ public: bool onLoadEnumerated(ReaderBase &attrReader); AttributeVector::SearchContext::UP - getSearch(QueryTermSimple::UP term, const AttributeVector::SearchContext::Params & params) const override; + getSearch(std::unique_ptr<QueryTermSimple> term, const AttributeVector::SearchContext::Params & params) const override; void set(DocId doc, T v) { _data[doc] = v; diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp index 713ab52186e..eae1bc93c59 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp @@ -7,6 +7,7 @@ #include "load_utils.h" #include "primitivereader.h" #include "attributeiterators.hpp" +#include <vespa/searchlib/queryeval/emptysearch.h> namespace search { @@ -223,8 +224,8 @@ SingleValueNumericAttribute<B>::SingleSearchContext<M>::getAsIntegerTerm() const template <typename B> template <typename M> std::unique_ptr<queryeval::SearchIterator> -SingleValueNumericAttribute<B>::SingleSearchContext<M>::createFilterIterator(fef::TermFieldMatchData * matchData, - bool strict) +SingleValueNumericAttribute<B>::SingleSearchContext<M>:: +createFilterIterator(fef::TermFieldMatchData * matchData, bool strict) { if (!valid()) { return queryeval::SearchIterator::UP(new queryeval::EmptySearch()); diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h index 8aeb71de421..416e32268dc 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h @@ -4,8 +4,6 @@ #include "singleenumattribute.h" #include "numericbase.h" -#include "attributeiterators.h" -#include <vespa/searchlib/queryeval/emptysearch.h> #include <map> namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp index 72ca876676c..556aa6361c7 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp @@ -8,6 +8,7 @@ #include "loadednumericvalue.h" #include "primitivereader.h" #include "attributeiterators.hpp" +#include <vespa/searchlib/queryeval/emptysearch.h> #include <vespa/searchlib/query/queryterm.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp index 433684143b9..b15cfead9f3 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp @@ -3,6 +3,8 @@ #include "singlesmallnumericattribute.h" #include "attributevector.hpp" #include "primitivereader.h" +#include "attributeiterators.hpp" +#include <vespa/searchlib/queryeval/emptysearch.h> namespace search { @@ -165,7 +167,7 @@ SingleValueSmallNumericAttribute::onSave(IAttributeSaveTarget &saveTarget) AttributeVector::SearchContext::UP -SingleValueSmallNumericAttribute::getSearch(QueryTermSimple::UP qTerm, +SingleValueSmallNumericAttribute::getSearch(std::unique_ptr<QueryTermSimple> qTerm, const SearchContext::Params & params) const { (void) params; @@ -211,7 +213,7 @@ SingleValueSmallNumericAttribute::getEstimatedSaveByteSize() const bool SingleValueSmallNumericAttribute::SingleSearchContext::valid() const { return this->isValid(); } -SingleValueSmallNumericAttribute::SingleSearchContext::SingleSearchContext(QueryTermSimple::UP qTerm, +SingleValueSmallNumericAttribute::SingleSearchContext::SingleSearchContext(std::unique_ptr<QueryTermSimple> qTerm, const NumericAttribute & toBeSearched) : NumericAttribute::Range<T>(*qTerm), SearchContext(toBeSearched), _wordData(&static_cast<const SingleValueSmallNumericAttribute &>(toBeSearched)._wordData[0]), diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h index 684cc4e746c..483a82215ee 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h @@ -4,10 +4,7 @@ #include "integerbase.h" #include "floatbase.h" -#include "attributeiterators.hpp" #include <vespa/searchlib/common/rcuvector.h> -#include <vespa/searchlib/query/query.h> -#include <vespa/searchlib/queryeval/emptysearch.h> #include <limits> namespace search { @@ -81,7 +78,7 @@ public: bool valid() const override; public: - SingleSearchContext(QueryTermSimple::UP qTerm, const NumericAttribute & toBeSearched); + SingleSearchContext(std::unique_ptr<QueryTermSimple> qTerm, const NumericAttribute & toBeSearched); bool cmp(DocId docId, int32_t & weight) const { const Word &word = _wordData[docId >> _wordShift]; @@ -128,7 +125,7 @@ public: bool onLoad() override; void onSave(IAttributeSaveTarget &saveTarget) override; - SearchContext::UP getSearch(QueryTermSimple::UP term, const SearchContext::Params & params) const override; + SearchContext::UP getSearch(std::unique_ptr<QueryTermSimple> term, const SearchContext::Params & params) const override; T getFast(DocId doc) const { const Word &word = _wordData[doc >> _wordShift]; diff --git a/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp b/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp index 3ebecfc6b5e..ed04a2f94e9 100644 --- a/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp @@ -4,6 +4,7 @@ #include "btreeiterator.h" #include "btreeaggregator.h" +#include "btreenode.hpp" #include <vespa/vespalib/stllike/asciistream.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/parsequery/parse.h b/searchlib/src/vespa/searchlib/parsequery/parse.h index 889cc52f31c..23fee8ea6f7 100644 --- a/searchlib/src/vespa/searchlib/parsequery/parse.h +++ b/searchlib/src/vespa/searchlib/parsequery/parse.h @@ -1,16 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Creation date: 2000-05-15 - * - * Declaration of ParseItem class. - * - * Copyright (C) 1997-2003 Fast Search & Transfer ASA - * Copyright (C) 2003 Overture Services Norway AS - * ALL RIGHTS RESERVED - */ + #pragma once -#include <vespa/searchlib/query/tree/predicate_query_term.h> #include <vespa/searchlib/query/weight.h> #include <vespa/searchlib/util/rawbuf.h> #include <vespa/vespalib/stllike/string.h> diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.h b/searchlib/src/vespa/searchlib/predicate/simple_index.h index ebe8da593aa..731d6b9076d 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.h +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.h @@ -17,6 +17,7 @@ #include <vespa/vespalib/util/generationholder.h> #include <experimental/optional> + namespace search { namespace predicate { diff --git a/searchlib/src/vespa/searchlib/query/weight.h b/searchlib/src/vespa/searchlib/query/weight.h index 18c6a2edd78..84f607ff0e2 100644 --- a/searchlib/src/vespa/searchlib/query/weight.h +++ b/searchlib/src/vespa/searchlib/query/weight.h @@ -1,6 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include <cstdint> + namespace search { namespace query { diff --git a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp index 58a33c26d9f..497f8671075 100644 --- a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "andnotsearch.h" +#include <vespa/searchlib/common/bitvector.h> namespace search { namespace queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h index 4c6eae0693c..9bdbe55ec24 100644 --- a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h @@ -32,7 +32,7 @@ public: // Caller takes ownership of the returned SearchIterator. static SearchIterator *create(const Children &children, bool strict); - BitVector::UP get_hits(uint32_t begin_id) override; + std::unique_ptr<BitVector> get_hits(uint32_t begin_id) override; private: bool isAndNot() const override { return true; } |