summaryrefslogtreecommitdiffstats
path: root/searchsummary
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-05-19 09:58:42 +0000
committerArne Juul <arnej@verizonmedia.com>2020-05-19 09:58:42 +0000
commitb3d8cd7e38393e6a40ba15cedef0c2643a1a629f (patch)
treec51fd168f59fb8da4c2adf83b0bdb6ba228ce4c5 /searchsummary
parent45da1e2df5b46f36bfe480e059d2ce1a6098039b (diff)
wire in special case for maps to avoid keys/values just disappearing
Diffstat (limited to 'searchsummary')
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp16
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h1
2 files changed, 11 insertions, 6 deletions
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp
index a1f3ce4d392..4e3cbaa512d 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp
@@ -30,7 +30,8 @@ public:
const std::vector<vespalib::string> &attributeNames,
IAttributeContext &context,
const vespalib::string &field_name,
- const MatchingElements* matching_elements);
+ const MatchingElements* matching_elements,
+ bool is_map_of_scalar);
~ArrayAttributeFieldWriterState() override;
void insert_element(uint32_t element_index, Cursor &array);
void insertField(uint32_t docId, vespalib::slime::Inserter &target) override;
@@ -40,10 +41,11 @@ ArrayAttributeFieldWriterState::ArrayAttributeFieldWriterState(const std::vector
const std::vector<vespalib::string> &attributeNames,
IAttributeContext &context,
const vespalib::string &field_name,
- const MatchingElements *matching_elements)
+ const MatchingElements *matching_elements,
+ bool is_map_of_scalar)
: DocsumFieldWriterState(),
_writers(),
- _field_name(field_name),
+ _field_name(field_name),
_matching_elements(matching_elements)
{
size_t fields = fieldNames.size();
@@ -51,7 +53,7 @@ ArrayAttributeFieldWriterState::ArrayAttributeFieldWriterState(const std::vector
for (uint32_t field = 0; field < fields; ++field) {
const IAttributeVector *attr = context.getAttribute(attributeNames[field]);
if (attr != nullptr) {
- _writers.emplace_back(AttributeFieldWriter::create(fieldNames[field], *attr));
+ _writers.emplace_back(AttributeFieldWriter::create(fieldNames[field], *attr, is_map_of_scalar));
}
}
}
@@ -106,7 +108,8 @@ ArrayAttributeCombinerDFW::ArrayAttributeCombinerDFW(const vespalib::string &fie
std::shared_ptr<StructFieldMapper> struct_field_mapper)
: AttributeCombinerDFW(fieldName, filter_elements, std::move(struct_field_mapper)),
_fields(fields_resolver.get_array_fields()),
- _attributeNames(fields_resolver.get_array_attributes())
+ _attributeNames(fields_resolver.get_array_attributes()),
+ _is_map_of_scalar(fields_resolver.is_map_of_scalar())
{
if (filter_elements && _struct_field_mapper && !_struct_field_mapper->is_struct_field(fieldName)) {
fields_resolver.apply_to(*_struct_field_mapper);
@@ -118,7 +121,8 @@ ArrayAttributeCombinerDFW::~ArrayAttributeCombinerDFW() = default;
std::unique_ptr<DocsumFieldWriterState>
ArrayAttributeCombinerDFW::allocFieldWriterState(IAttributeContext &context, const MatchingElements* matching_elements)
{
- return std::make_unique<ArrayAttributeFieldWriterState>(_fields, _attributeNames, context, _fieldName, matching_elements);
+ return std::make_unique<ArrayAttributeFieldWriterState>(_fields, _attributeNames, context,
+ _fieldName, matching_elements, _is_map_of_scalar);
}
}
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h
index c3e686965cf..2fda1f69572 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h
+++ b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h
@@ -20,6 +20,7 @@ class ArrayAttributeCombinerDFW : public AttributeCombinerDFW
{
std::vector<vespalib::string> _fields;
std::vector<vespalib::string> _attributeNames;
+ bool _is_map_of_scalar;
std::unique_ptr<DocsumFieldWriterState> allocFieldWriterState(search::attribute::IAttributeContext &context, const MatchingElements* matching_elements) override;
public: