// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "documentstoreadapter.h" #include #include #include #include #include #include #include LOG_SETUP(".proton.docsummary.documentstoreadapter"); using namespace document; using namespace search::docsummary; namespace proton { namespace { const vespalib::string DOCUMENT_ID_FIELD("documentid"); } DocumentStoreAdapter:: DocumentStoreAdapter(const search::IDocumentStore & docStore, const DocumentTypeRepo &repo) : _docStore(docStore), _repo(repo) { } DocumentStoreAdapter::~DocumentStoreAdapter() = default; std::unique_ptr DocumentStoreAdapter::get_document(uint32_t docId) { auto document = _docStore.read(docId, _repo); if ( ! document) { LOG(debug, "Did not find summary document for docId %u. Returning empty docsum", docId); return {}; } LOG(spam, "getMappedDocSum(%u): document={\n%s\n}", docId, document->toString(true).c_str()); return std::make_unique(std::move(document)); } } // namespace proton