summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-09-02 14:01:07 +0200
committerTor Egge <Tor.Egge@broadpark.no>2020-09-02 14:26:31 +0200
commit0a45b7c0e4a6c0234ed83da41fb339f7a2bb0899 (patch)
tree75f0af6a198f8777e6e06b06d7e4d0c7b76ac217 /searchcore
parentdcfad38e1f6102d2d8ba97620f68d243745439ad (diff)
Handle matched-elements-only for weighted set term operator and
fast-search attributes (weighted set, string or long).
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp
index 361fde48aa8..abd4a9cfbe4 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp
@@ -11,6 +11,7 @@
#include <vespa/searchlib/queryeval/intermediate_blueprints.h>
#include <vespa/searchlib/queryeval/same_element_blueprint.h>
#include <vespa/searchlib/queryeval/same_element_search.h>
+#include <vespa/searchlib/queryeval/matching_elements_search.h>
#include <vespa/searchlib/fef/feature_resolver.h>
#include <vespa/searchlib/fef/rank_program.h>
@@ -25,6 +26,7 @@ using search::fef::RankProgram;
using search::queryeval::AndNotBlueprint;
using search::queryeval::Blueprint;
using search::queryeval::IntermediateBlueprint;
+using search::queryeval::MatchingElementsSearch;
using search::queryeval::SameElementBlueprint;
using search::queryeval::SearchIterator;
@@ -106,6 +108,13 @@ void find_matching_elements(const std::vector<uint32_t> &docs, const SameElement
}
}
+void find_matching_elements(const std::vector<uint32_t> &docs, MatchingElementsSearch &search, MatchingElements &result) {
+ search.initRange(docs.front(), docs.back() + 1);
+ for (uint32_t i = 0; i < docs.size(); ++i) {
+ search.find_matching_elements(docs[i], result);
+ }
+}
+
void find_matching_elements(const std::vector<uint32_t> &docs, const vespalib::string &field_name, const AttrSearchCtx &attr_ctx, MatchingElements &result) {
int32_t weight = 0;
std::vector<uint32_t> matches;
@@ -125,6 +134,8 @@ void find_matching_elements(const MatchingElementsFields &fields, const std::vec
if (fields.has_field(same_element->field_name())) {
find_matching_elements(docs, *same_element, result);
}
+ } else if (auto matching_elements_search = bp.create_matching_elements_search(fields)) {
+ find_matching_elements(docs, *matching_elements_search, result);
} else if (const AttrSearchCtx *attr_ctx = bp.get_attribute_search_context()) {
if (fields.has_struct_field(attr_ctx->attributeName())) {
find_matching_elements(docs, fields.get_enclosing_field(attr_ctx->attributeName()), *attr_ctx, result);