Use empty search when asked for an underestimate filter for same element blueprint.
#include "same_element_search.h"
#include "field_spec.hpp"
#include "andsearch.h"
+#include "emptysearch.h"
#include <vespa/searchlib/fef/termfieldmatchdata.h>
#include <vespa/searchlib/attribute/searchcontextelementiterator.h>
#include <vespa/vespalib/objects/visit.hpp>
@@ -92,6 +93,7 @@ SameElementBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArra
SearchIterator::UP
SameElementBlueprint::createFilterSearch(bool strict, FilterConstraint constraint) const
{
+ if (constraint == Blueprint::FilterConstraint::UPPER_BOUND) {
MultiSearch::Children sub_searches;
sub_searches.reserve(_terms.size());
for (size_t i = 0; i < _terms.size(); ++i) {
@@ -101,6 +103,9 @@ SameElementBlueprint::createFilterSearch(bool strict, FilterConstraint constrain
UnpackInfo unpack_info;
auto search = AndSearch::create(std::move(sub_searches), strict, unpack_info);
return search;
+ } else {
+ return std::make_unique<EmptySearch>();
+ }
}
void
