summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-09-01 19:38:33 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-09-01 19:38:33 +0200
commit12a0d49d085cf961f21ea1459de16703e8345b5b (patch)
tree86d54bbc5a13dbc72e59a4d0e316d68bfa7cbe12 /searchlib
parenteb5d7374258adb73d2e024c830f2ad6c8dd5919a (diff)
Simplify targetIterator loop.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
index c1b8550c170..2ec4d8c2be9 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
@@ -96,8 +96,8 @@ class ReverseMappingBitVector
EntryRef _revMapIdx;
public:
ReverseMappingBitVector(const ReverseMapping &reverseMapping, EntryRef revMapIdx)
- : _reverseMapping(reverseMapping),
- _revMapIdx(revMapIdx)
+ : _reverseMapping(reverseMapping),
+ _revMapIdx(revMapIdx)
{}
~ReverseMappingBitVector() { }
@@ -155,26 +155,16 @@ TargetResult::getResult(ReverseMappingRefs reverseMappingRefs, const ReverseMapp
PostingListMerger<int32_t> & merger)
{
fef::TermFieldMatchData matchData;
- auto targetItr = target_search_context.createIterator(&matchData, true);
+ auto it = target_search_context.createIterator(&matchData, true);
uint32_t docIdLimit = reverseMappingRefs.size();
if (docIdLimit > committedDocIdLimit) {
docIdLimit = committedDocIdLimit;
}
- uint32_t lid = 1;
- targetItr->initRange(1, docIdLimit);
- while (lid < docIdLimit) {
- if (targetItr->seek(lid)) {
- EntryRef revMapIdx = reverseMappingRefs[lid];
- if (revMapIdx.valid()) {
- merger.addToBitVector(ReverseMappingBitVector(reverseMapping, revMapIdx));
- }
- ++lid;
- } else {
- ++lid;
- uint32_t nextLid = targetItr->getDocId();
- if (nextLid > lid) {
- lid = nextLid;
- }
+ it->initRange(1, docIdLimit);
+ for (uint32_t lid = it->seekFirst(1); !it->isAtEnd(); lid = it->seekNext(lid+1)) {
+ EntryRef revMapIdx = reverseMappingRefs[lid];
+ if (__builtin_expect(revMapIdx.valid(), true)) {
+ merger.addToBitVector(ReverseMappingBitVector(reverseMapping, revMapIdx));
}
}
}