aboutsummaryrefslogtreecommitdiffstats
path: root/searchsummary
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahooinc.com>2022-07-01 00:11:11 +0200
committerTor Egge <Tor.Egge@yahooinc.com>2022-07-01 00:11:11 +0200
commitd20d6e69f3f6d95aa06804a70bb819ad4c6fab7e (patch)
tree7248eaae49ab09b3aa54ca394d4c2e76548e4d22 /searchsummary
parentb68a837f1079d3ccbfd739aee39796ce73edac24 (diff)
Provide access to original document when making document summary
for streaming search.
Diffstat (limited to 'searchsummary')
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.cpp16
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/docsumstorevalue.h12
2 files changed, 24 insertions, 4 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; }
};
}