aboutsummaryrefslogtreecommitdiffstats
path: root/searchsummary
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2024-03-27 21:19:45 +0100
committerTor Egge <Tor.Egge@online.no>2024-03-27 21:19:45 +0100
commit930c14a264ed24a5782426315c662e5106aa55de (patch)
tree9e451cd6371d2dc4f636b593cb44edb65c73d0d8 /searchsummary
parent45e8c0c2b2ab7b3ac9d8e6a8f174b08ac15b342e (diff)
Handle attribute tokens dfw for delayed add attribute aspect.
Diffstat (limited to 'searchsummary')
-rw-r--r--searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp6
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp8
2 files changed, 12 insertions, 2 deletions
diff --git a/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp b/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp
index bac817077c4..e360c3005b8 100644
--- a/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp
+++ b/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp
@@ -94,4 +94,10 @@ TEST_F(AttributeTokensDFWTest, single_string)
expect_field("[ '' ]", 2);
}
+TEST_F(AttributeTokensDFWTest, missing_atribute)
+{
+ setup("delayed_add_attribute_aspect");
+ expect_field("null", 1);
+}
+
GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp
index 9e0dafc5e91..e47d16b03c0 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp
@@ -170,8 +170,12 @@ AttributeTokensDFW::insertField(uint32_t docid, const IDocsumStoreDocument*, Get
{
auto& field_writer_state = state._fieldWriterStates[_state_index];
if (!field_writer_state) {
- const auto& attr = *state.getAttribute(getIndex());
- field_writer_state = make_field_writer_state(attr, state.get_stash());
+ const auto attr = state.getAttribute(getIndex());
+ if (attr != nullptr) {
+ field_writer_state = make_field_writer_state(*attr, state.get_stash());
+ } else {
+ field_writer_state = &state.get_stash().create<EmptyDocsumFieldWriterState>();
+ }
}
field_writer_state->insertField(docid, target);
}