aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2024-04-17 16:52:22 +0200
committerTor Egge <Tor.Egge@online.no>2024-04-17 16:52:22 +0200
commit644faea88576ab60528cb59e1b306bbde39d1a76 (patch)
tree45aab662a54c7076ff11895bf1309ff34056f40a /searchcore/src
parent9482a6424f270ed23389e294c403c75ba87dc38e (diff)
Set docid limit early in blueprint subtree.
Cap matching doc count to total doc count.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
index c03d93b6480..0b2660824c0 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
@@ -88,6 +88,7 @@ private:
double w = getWeightFromNode(*node).percent();
eq->addTerm(build(_requestContext, *node, _context), w / eqw);
}
+ _result->setDocIdLimit(_context.getDocIdLimit());
n.setDocumentFrequency(_result->getState().estimate().estHits, _context.getDocIdLimit());
}
@@ -123,6 +124,7 @@ private:
indexBlueprint = _context.getIndexes().createBlueprint(_requestContext, indexFields, n);
}
_result = mixer.mix(std::move(indexBlueprint));
+ _result->setDocIdLimit(_context.getDocIdLimit());
n.setDocumentFrequency(_result->getState().estimate().estHits, _context.getDocIdLimit());
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp b/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp
index 60c2e869e79..47a9f3dd43d 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp
@@ -93,7 +93,8 @@ void
ProtonTermData::setDocumentFrequency(uint32_t estHits, uint32_t docIdLimit)
{
if (docIdLimit > 1) {
- propagate_document_frequency(estHits, docIdLimit - 1);
+ uint32_t total_doc_count = docIdLimit - 1;
+ propagate_document_frequency(std::min(estHits, total_doc_count), total_doc_count);
} else {
propagate_document_frequency(0, 1);
}