summaryrefslogtreecommitdiffstats
path: root/searchsummary
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-10-08 13:27:26 +0000
committerGeir Storli <geirst@verizonmedia.com>2019-10-08 13:27:26 +0000
commite8828256eb5cedb7ae55c7ea494884cc90706b8a (patch)
tree02c0b01c3402f20d48999f78e4aff748d607f6a5 /searchsummary
parentb57b992bd230b3de1b8cc628a9438042405bf8c4 (diff)
Wire in matched elements filter field writer.
Diffstat (limited to 'searchsummary')
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp
index f5a2f0b5833..9235ce2b181 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp
@@ -1,14 +1,15 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include "attribute_combiner_dfw.h"
#include "docsumconfig.h"
#include "docsumwriter.h"
+#include "geoposdfw.h"
#include "idocsumenvironment.h"
+#include "juniperdfw.h"
+#include "matched_elements_filter_dfw.h"
+#include "positionsdfw.h"
#include "rankfeaturesdfw.h"
#include "textextractordfw.h"
-#include "geoposdfw.h"
-#include "positionsdfw.h"
-#include "juniperdfw.h"
-#include "attribute_combiner_dfw.h"
#include <vespa/searchlib/common/struct_field_mapper.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/exceptions.h>
@@ -106,6 +107,14 @@ DynamicDocsumConfig::createFieldWriter(const string & fieldName, const string &
fieldWriter = AttributeCombinerDFW::create(source_field, *attr_ctx, true, struct_field_mapper);
rc = static_cast<bool>(fieldWriter);
}
+ } else if (overrideName == "matchedelementsfilter") {
+ string source_field = argument.empty() ? fieldName : argument;
+ if (getEnvironment() && getEnvironment()->getAttributeManager()) {
+ auto attr_ctx = getEnvironment()->getAttributeManager()->createContext();
+ fieldWriter = MatchedElementsFilterDFW::create(source_field, resultConfig.GetFieldNameEnum().Lookup(source_field.c_str()),
+ *attr_ctx, struct_field_mapper);
+ rc = static_cast<bool>(fieldWriter);
+ }
} else {
throw IllegalArgumentException("unknown override operation '" + overrideName + "' for field '" + fieldName + "'.");
}