diff options
3 files changed, 27 insertions, 5 deletions
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.cpp index d63be095291..8fbbeb6db28 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.cpp @@ -7,19 +7,29 @@ namespace search::docsummary { DocsumStoreValue::DocsumStoreValue() : _value(static_cast<const char*>(0), 0), - _document() + _document(), + _document_ptr(nullptr) { } DocsumStoreValue::DocsumStoreValue(const char *pt_, uint32_t len_) : _value(pt_, len_), - _document() + _document(), + _document_ptr(nullptr) { } DocsumStoreValue::DocsumStoreValue(const char *pt_, uint32_t len_, std::unique_ptr<document::Document> document_) : _value(pt_, len_), - _document(std::move(document_)) + _document(std::move(document_)), + _document_ptr(_document.get()) +{ +} + +DocsumStoreValue::DocsumStoreValue(const char *pt_, uint32_t len_, const document::Document* document_ptr) + : _value(pt_, len_), + _document(), + _document_ptr(document_ptr) { } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.h b/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.h index c0bbaa15975..bd6454d9c87 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.h @@ -23,6 +23,7 @@ private: // Note: This is temporary until the docsummary framework is simplified, // and the docsum blob concept is removed. std::unique_ptr<document::Document> _document; + const document::Document* _document_ptr; public: DocsumStoreValue(const DocsumStoreValue&) = delete; @@ -50,6 +51,15 @@ public: **/ DocsumStoreValue(const char *pt_, uint32_t len_, std::unique_ptr<document::Document> document_); + /** + * Construct object encapsulating the given location and size. + * + * @param pt_ docsum location + * @param len_ docsum size + * @param document_ptr document instance used to generate the docsum blob. Note: external ownership. + **/ + DocsumStoreValue(const char *pt_, uint32_t len_, const document::Document* document_ptr); + ~DocsumStoreValue(); /** @@ -77,7 +87,7 @@ public: **/ bool valid() const { return (_value.first != 0) && (_value.second >= sizeof(uint32_t)); } - const document::Document* get_document() const { return _document.get(); } + const document::Document* get_document() const { return _document_ptr; } }; } diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp b/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp index 70759feb41c..ebbb8df3cf1 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp @@ -468,7 +468,9 @@ DocsumFilter::getMappedDocsum(uint32_t id) uint32_t buflen; bool ok = _packer.GetDocsumBlob(&buf, &buflen); if (ok) { - return DocsumStoreValue(buf, buflen); + const auto* storage_doc = dynamic_cast<const StorageDocument *>(&doc); + const document::Document *doc_doc = (storage_doc != nullptr && storage_doc->valid()) ? &storage_doc->docDoc() : nullptr; + return DocsumStoreValue(buf, buflen, doc_doc); } else { return DocsumStoreValue(nullptr, 0); } |