summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-05-13 23:32:41 +0200
committerTor Egge <Tor.Egge@online.no>2022-05-13 23:32:41 +0200
commit4e51a28b1ab293c69ed33811813ceec7485d9d83 (patch)
tree8b97a7356012c8849abcba3289e886bb48d38c42 /searchlib
parent0e4d2fe579bd9f6175a3fd1ff4c37b75fccd92f8 (diff)
Use bitvector iterator if attribute term is not used by ranking
(i.e. unpack not needed).
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp23
2 files changed, 6 insertions, 19 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
index 5cc7c13c6bd..61bd8e2e2bb 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
@@ -89,8 +89,6 @@ protected:
return (numHits > 1000) &&
(calculateFilteringCost() < calculatePostingListCost(numHits));
}
-
-public:
};
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
index 14e0cf041f2..95bbaf27c26 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
@@ -45,21 +45,10 @@ PostingListSearchContextT<DataT>::lookupSingle()
if (_postingList.isBitVector(typeId)) {
const BitVectorEntry *bve = _postingList.getBitVectorEntry(_pidx);
const GrowableBitVector *bv = bve->_bv.get();
- if (_useBitVector) {
- _bv = &bv->reader();
- } else {
- _pidx = bve->_tree;
- if (_pidx.valid()) {
- auto frozenView = _postingList.getTreeEntry(_pidx)->getFrozenView(_postingList.getAllocator());
- _frozenRoot = frozenView.getRoot();
- if (!_frozenRoot.valid()) {
- _pidx = vespalib::datastore::EntryRef();
- }
- } else {
- _bv = &bv->reader();
- }
- }
- } else {
+ _bv = &bv->reader();
+ _pidx = bve->_tree;
+ }
+ if (_pidx.valid()) {
auto frozenView = _postingList.getTreeEntry(_pidx)->getFrozenView(_postingList.getAllocator());
_frozenRoot = frozenView.getRoot();
if (!_frozenRoot.valid()) {
@@ -179,7 +168,7 @@ createPostingIterator(fef::TermFieldMatchData *matchData, bool strict)
return search::BitVectorIterator::create(bv, bv->size(), *matchData, strict);
}
if (_uniqueValues == 1) {
- if (_bv != nullptr) {
+ if (_bv != nullptr && (!_pidx.valid() || _useBitVector || matchData->isNotNeeded())) {
return BitVectorIterator::create(_bv, std::min(_bv->size(), _docIdLimit), *matchData, strict);
}
if (!_pidx.valid()) {
@@ -217,7 +206,7 @@ template <typename DataT>
unsigned int
PostingListSearchContextT<DataT>::singleHits() const
{
- if (_bv) {
+ if (_bv && !_pidx.valid()) {
// Some inaccuracy is expected, data changes underfeet
return _bv->countTrueBits();
}