summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-02-09 14:56:01 +0200
committerGitHub <noreply@github.com>2017-02-09 14:56:01 +0200
commitee78e9d3af060ee832c9527d09e8f858ae2f7bbf (patch)
treeba35d796b45fbdd14e44d63bb3ca9820bbd73d2c /searchlib
parent1f986c231a7f1867996c4cbf63d05190e388037c (diff)
parent67896d19084c7607a74093fcaea8ebf3d0194904 (diff)
Merge pull request #1719 from yahoo/balder/implement-get_hits-for-attribute-postinglist-iterators
Balder/implement get hits for attribute postinglist iterators
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/attributesearcher.h1
-rw-r--r--searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp2
-rw-r--r--searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp1
-rw-r--r--searchlib/src/tests/attribute/searchcontext/searchcontext.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributeiterators.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributeiterators.h219
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp137
-rw-r--r--searchlib/src/vespa/searchlib/attribute/dociditerator.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/flagattribute.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/iterator_pack.h5
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericattribute.h16
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h7
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp5
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h7
-rw-r--r--searchlib/src/vespa/searchlib/btree/btreeiterator.hpp1
-rw-r--r--searchlib/src/vespa/searchlib/features/attributefeature.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/features/matchcountfeature.cpp5
-rw-r--r--searchlib/src/vespa/searchlib/features/valuefeature.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/parsequery/parse.h11
-rw-r--r--searchlib/src/vespa/searchlib/predicate/simple_index.h1
-rw-r--r--searchlib/src/vespa/searchlib/query/weight.h2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/andnotsearch.h2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/blueprint.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/iterator_pack.h4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp26
35 files changed, 278 insertions, 261 deletions
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/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
index dc70a8c7193..a6c554e01b7 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
@@ -290,6 +290,7 @@ public:
_terms(),
_attr(attr)
{
+ set_allow_termwise_eval(true);
_weights.reserve(size_hint);
_terms.reserve(size_hint);
}
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp
index 0b43b44c800..cba4084265a 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp
@@ -123,6 +123,7 @@ AttributeWeightedSetBlueprint::AttributeWeightedSetBlueprint(const queryeval::Fi
_attr(attr),
_contexts()
{
+ set_allow_termwise_eval(true);
}
AttributeWeightedSetBlueprint::~AttributeWeightedSetBlueprint()
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 33fd955c7e1..c75483330bc 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.h
@@ -3,16 +3,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).
@@ -20,6 +21,8 @@ namespace search {
class AttributeIteratorBase : public queryeval::SearchIterator
{
protected:
+ template <typename SC>
+ void and_hits_into(const SC & sc, BitVector & result, uint32_t begin_id) const;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
fef::TermFieldMatchData * _matchData;
fef::TermFieldMatchDataPosition * _matchPosition;
@@ -46,8 +49,7 @@ public:
: AttributeIteratorBase(matchData),
_docIdLimit(docIdLimit),
_weight(1)
- {
- }
+ { }
protected:
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
void doUnpack(uint32_t docId) override;
@@ -58,12 +60,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;
@@ -76,6 +73,7 @@ class AttributeIteratorT : public AttributeIterator
private:
void doSeek(uint32_t docId) override;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
+ void and_hits_into(BitVector & result, uint32_t begin_id) override;
protected:
const SC & _searchContext;
@@ -92,6 +90,7 @@ class FilterAttributeIteratorT : public FilterAttributeIterator
private:
void doSeek(uint32_t docId) override;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
+ void and_hits_into(BitVector & result, uint32_t begin_id) override;
protected:
const SC & _searchContext;
@@ -146,55 +145,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 +204,12 @@ 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;
+ std::unique_ptr<BitVector> get_hits(uint32_t begin_id) override;
public:
// Note: iterator constructor argument is destroyed
- AttributePostingListIteratorT(PL &iterator,
- bool hasWeight,
+ AttributePostingListIteratorT(PL &iterator, bool hasWeight,
fef::TermFieldMatchData *matchData);
};
@@ -277,6 +219,10 @@ class FilterAttributePostingListIteratorT
{
private:
PL _iterator;
+public:
+ std::unique_ptr<BitVector> get_hits(uint32_t begin_id) override;
+
+private:
queryeval::MinMaxPostingInfo _postingInfo;
bool _postingInfoValid;
@@ -287,21 +233,12 @@ 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
- FilterAttributePostingListIteratorT(PL &iterator,
- fef::TermFieldMatchData *matchData);
+ FilterAttributePostingListIteratorT(PL &iterator, fef::TermFieldMatchData *matchData);
};
@@ -318,104 +255,52 @@ 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<btree::BTreeConstIterator<uint32_t, btree::BTreeNoLeafData, btree::NoAggregated,
+ std::less<uint32_t>, btree::BTreeDefaultTraits> >::
+ doUnpack(uint32_t docId);
-template <>
-void
-AttributePostingListIteratorT<DocIdMinMaxIterator<AttributePosting> >::
-setupPostingInfo();
+ template <>
+ void
+ AttributePostingListIteratorT<btree::BTreeConstIterator<uint32_t, int32_t, btree::MinMaxAggregated,
+ std::less<uint32_t>, btree::BTreeDefaultTraits> >::
+ doUnpack(uint32_t docId);
-template <>
-void
-AttributePostingListIteratorT<DocIdMinMaxIterator<AttributeWeightPosting> >::
-setupPostingInfo();
+ template <>
+ void
+ AttributePostingListIteratorT<InnerAttributePostingListIterator>::setupPostingInfo();
-template <>
-void
-FilterAttributePostingListIteratorT<InnerAttributePostingListIterator>::
-setupPostingInfo();
+ template <>
+ void
+ AttributePostingListIteratorT<WeightedInnerAttributePostingListIterator>::setupPostingInfo();
-template <>
-void
-FilterAttributePostingListIteratorT<WeightedInnerAttributePostingListIterator>::
-setupPostingInfo();
+ template <>
+ void
+ AttributePostingListIteratorT<DocIdMinMaxIterator<AttributePosting> >::setupPostingInfo();
-template <>
-void
-FilterAttributePostingListIteratorT<DocIdMinMaxIterator<AttributePosting> >::
-setupPostingInfo();
+ template <>
+ void
+ AttributePostingListIteratorT<DocIdMinMaxIterator<AttributeWeightPosting> >::setupPostingInfo();
-template <>
-void
-FilterAttributePostingListIteratorT<DocIdMinMaxIterator<AttributeWeightPosting> >::
-setupPostingInfo();
+ template <>
+ void
+ FilterAttributePostingListIteratorT<InnerAttributePostingListIterator>::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 <>
+ void
+ FilterAttributePostingListIteratorT<WeightedInnerAttributePostingListIterator>::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);
-}
+ template <>
+ void
+ FilterAttributePostingListIteratorT<DocIdMinMaxIterator<AttributePosting> >::setupPostingInfo();
/**
* 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 9faee8ba504..6c8ab2fa9c2 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp
@@ -5,11 +5,68 @@
#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 SC>
+void
+AttributeIteratorBase::and_hits_into(const SC & sc, BitVector & result, uint32_t begin_id) const {
+ result.foreach_truebit([&](uint32_t key) { if ( ! sc.cmp(key)) { result.clearBit(key); }}, begin_id);
+}
+
+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)
@@ -23,6 +80,26 @@ AttributePostingListIteratorT<PL>::doSeek(uint32_t docId)
}
template <typename PL>
+std::unique_ptr<BitVector>
+AttributePostingListIteratorT<PL>::get_hits(uint32_t begin_id) {
+ BitVector::UP result(BitVector::create(begin_id, getEndId()));
+ for (; _iterator.valid() && _iterator.getKey() < getEndId(); ++_iterator) {
+ result->setBit(_iterator.getKey());
+ }
+ return result;
+}
+
+template <typename PL>
+std::unique_ptr<BitVector>
+FilterAttributePostingListIteratorT<PL>::get_hits(uint32_t begin_id) {
+ BitVector::UP result(BitVector::create(begin_id, getEndId()));
+ for (; _iterator.valid() && _iterator.getKey() < getEndId(); ++_iterator) {
+ result->setBit(_iterator.getKey());
+ }
+ return result;
+}
+
+template <typename PL>
void
FilterAttributePostingListIteratorT<PL>::doSeek(uint32_t docId)
{
@@ -134,5 +211,65 @@ 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();
+}
+
+template <typename SC>
+void
+AttributeIteratorT<SC>::and_hits_into(BitVector & result, uint32_t begin_id) {
+ AttributeIteratorBase::and_hits_into(_searchContext, result, begin_id);
+}
+
+
+template <typename SC>
+void
+FilterAttributeIteratorT<SC>::and_hits_into(BitVector & result, uint32_t begin_id) {
+ AttributeIteratorBase::and_hits_into(_searchContext, result, begin_id);
+}
} // namespace search
diff --git a/searchlib/src/vespa/searchlib/attribute/dociditerator.h b/searchlib/src/vespa/searchlib/attribute/dociditerator.h
index cd16845e1a1..dcce2b150c8 100644
--- a/searchlib/src/vespa/searchlib/attribute/dociditerator.h
+++ b/searchlib/src/vespa/searchlib/attribute/dociditerator.h
@@ -32,8 +32,8 @@ public:
}
}
- uint32_t getKey(void) const { return _cur->_key; }
- inline int32_t getData(void) const { return _cur->getData(); }
+ uint32_t getKey() const { return _cur->_key; }
+ inline int32_t getData() const { return _cur->getData(); }
void set(const P *begin, const P *end) {
_cur = begin;
@@ -83,7 +83,7 @@ public:
{ }
inline btree::MinMaxAggregated
- getAggregated(void) const {
+ getAggregated() const {
return btree::MinMaxAggregated(1, 1);
}
};
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/iterator_pack.h b/searchlib/src/vespa/searchlib/attribute/iterator_pack.h
index fa4b64599f6..9ddf8cdff9f 100644
--- a/searchlib/src/vespa/searchlib/attribute/iterator_pack.h
+++ b/searchlib/src/vespa/searchlib/attribute/iterator_pack.h
@@ -42,6 +42,11 @@ public:
return _children[ref].getData();
}
+ uint32_t next(uint16_t ref) {
+ ++_children[ref];
+ return get_docid(ref);
+ }
+
size_t size() const { return _children.size(); }
void initRange(uint32_t begin, uint32_t end) {
(void) end;
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/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp
index 9a4dea637b3..a389ebcd058 100644
--- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp
@@ -1,8 +1,5 @@
// 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(".features.attributefeature");
#include "attributefeature.h"
#include "utils.h"
#include "valuefeature.h"
@@ -10,15 +7,15 @@ LOG_SETUP(".features.attributefeature");
#include <vespa/searchcommon/common/undefinedvalues.h>
#include <vespa/searchcommon/attribute/attributecontent.h>
#include <vespa/searchlib/tensor/dense_tensor_attribute.h>
-#include <vespa/searchlib/tensor/tensor_attribute.h>
#include <vespa/searchlib/features/constant_tensor_executor.h>
#include <vespa/searchlib/features/dense_tensor_attribute_executor.h>
#include <vespa/searchlib/features/tensor_attribute_executor.h>
-#include <vespa/searchlib/fef/fieldinfo.h>
#include <vespa/searchlib/fef/indexproperties.h>
#include <vespa/searchlib/attribute/singlenumericattribute.h>
-#include <vespa/eval/eval/value_type.h>
-#include <vespa/searchlib/fef/feature_type.h>
+
+#include <vespa/log/log.h>
+LOG_SETUP(".features.attributefeature");
+
using search::attribute::IAttributeVector;
using search::attribute::BasicType;
diff --git a/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp b/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp
index 98e574155ba..6315ba967c5 100644
--- a/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp
@@ -1,14 +1,9 @@
// 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/searchlib/fef/fieldinfo.h>
#include "matchcountfeature.h"
#include "utils.h"
#include "valuefeature.h"
-#include <vespa/log/log.h>
-LOG_SETUP(".features.matchcountfeature");
-
using namespace search::fef;
namespace search {
diff --git a/searchlib/src/vespa/searchlib/features/valuefeature.cpp b/searchlib/src/vespa/searchlib/features/valuefeature.cpp
index 85f062d7673..884728aef69 100644
--- a/searchlib/src/vespa/searchlib/features/valuefeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/valuefeature.cpp
@@ -1,11 +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 <vespa/log/log.h>
-LOG_SETUP(".features.value");
#include "valuefeature.h"
-
-#include <sstream>
+#include <vespa/vespalib/stllike/asciistream.h>
namespace search {
namespace features {
@@ -51,9 +47,9 @@ ValueBlueprint::setup(const search::fef::IIndexEnvironment &,
{
for (uint32_t i = 0; i < params.size(); ++i) {
_values.push_back(params[i].asDouble());
- std::ostringstream name;
+ vespalib::asciistream name;
name << i;
- std::ostringstream desc;
+ vespalib::asciistream desc;
desc << "value " << i;
describeOutput(name.str(), desc.str());
// we have no inputs
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; }
diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
index 9e324a5f260..d27e89e6246 100644
--- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
@@ -1,20 +1,14 @@
// 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>
#include "blueprint.h"
#include <vespa/vespalib/objects/visit.hpp>
#include <vespa/vespalib/objects/objectdumper.h>
-#include <vespa/vespalib/util/stringfmt.h>
#include "leaf_blueprints.h"
#include "intermediate_blueprints.h"
#include "equiv_blueprint.h"
#include <vespa/vespalib/util/classname.h>
-#include <vector>
-#include <set>
-#include <map>
-
+#include <vespa/log/log.h>
LOG_SETUP(".queryeval.blueprint");
namespace search {
diff --git a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h
index ac19bca3626..354639a7221 100644
--- a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h
+++ b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h
@@ -54,6 +54,10 @@ public:
return _children[ref]->getDocId();
}
+ uint32_t next(uint32_t ref) {
+ return seek(ref, _children[ref]->getDocId()+1);
+ }
+
uint32_t seek(uint32_t ref, uint32_t docid) {
_children[ref]->seek(docid);
return _children[ref]->getDocId();
diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp
index 8c73601c312..a521ea4ba57 100644
--- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp
@@ -1,12 +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 "weighted_set_term_blueprint.h"
#include "weighted_set_term_search.h"
-#include <vespa/searchlib/fef/termfieldmatchdata.h>
-#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/vespalib/objects/visit.hpp>
-#include <algorithm>
namespace search {
namespace queryeval {
@@ -17,6 +13,7 @@ WeightedSetTermBlueprint::WeightedSetTermBlueprint(const FieldSpec &field)
_weights(),
_terms()
{
+ set_allow_termwise_eval(true);
}
WeightedSetTermBlueprint::~WeightedSetTermBlueprint()
@@ -45,8 +42,7 @@ WeightedSetTermBlueprint::addTerm(Blueprint::UP term, int32_t weight)
}
SearchIterator::UP
-WeightedSetTermBlueprint::createSearch(search::fef::MatchData &md,
- bool) const
+WeightedSetTermBlueprint::createSearch(search::fef::MatchData &md, bool) const
{
const State &state = getState();
assert(state.numFields() == 1);
diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp
index fe8c3273153..49eaa7b18ea 100644
--- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp
@@ -1,14 +1,9 @@
// 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(".queryeval.weighted_set_term.search");
-
#include "weighted_set_term_search.h"
-#include <vespa/searchlib/fef/termfieldmatchdata.h>
+#include <vespa/searchlib/common/bitvector.h>
#include <vespa/vespalib/objects/visit.h>
-#include <algorithm>
-#include <functional>
+
#include "iterator_pack.h"
using search::fef::TermFieldMatchData;
@@ -120,7 +115,22 @@ public:
}
Trinary is_strict() const override { return Trinary::True; }
- void visitMembers(vespalib::ObjectVisitor &) const override {}
+ void visitMembers(vespalib::ObjectVisitor &) const override { }
+
+ BitVector::UP get_hits(uint32_t begin_id) override {
+ BitVector::UP result(BitVector::create(begin_id, getEndId()));
+
+ for (size_t i = 0; i < _children.size(); ++i) {
+ uint32_t docId = _children.get_docid(i);
+ if (begin_id > docId) {
+ _children.seek(i, begin_id);
+ }
+ for (docId = _children.get_docid(i); ! isAtEnd(docId); docId = _children.next(i)) {
+ result->setBit(docId);
+ }
+ }
+ return result;
+ }
};
//-----------------------------------------------------------------------------