From 0a45b7c0e4a6c0234ed83da41fb339f7a2bb0899 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Wed, 2 Sep 2020 14:01:07 +0200 Subject: Handle matched-elements-only for weighted set term operator and fast-search attributes (weighted set, string or long). --- .../src/vespa/searchcore/proton/matching/docsum_matcher.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'searchcore') 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 #include #include +#include #include #include @@ -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 &docs, const SameElement } } +void find_matching_elements(const std::vector &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 &docs, const vespalib::string &field_name, const AttrSearchCtx &attr_ctx, MatchingElements &result) { int32_t weight = 0; std::vector 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); -- cgit v1.2.3