diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-02-05 10:41:28 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-02-05 10:44:02 +0000 |
commit | 20e7cf51b4cc808dab3e2d10473976f04174147b (patch) | |
tree | 270332b161f90ef6b88c3da6bdcdd7c6f6855635 /searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp | |
parent | b2fc8e4051afa7c5398ba198f34d6141e6a07fed (diff) |
- Collapse and simplify inheritance of DynamicTeaserDFW -> JuniperTeaserDFW -> JuniperDFW.
- Perform all initialization in constructor.
Diffstat (limited to 'searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp')
-rw-r--r-- | searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp index 28a2c34ca87..aa4a4342b0d 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp @@ -9,7 +9,7 @@ #include "empty_dfw.h" #include "geoposdfw.h" #include "idocsumenvironment.h" -#include "juniperdfw.h" +#include "dynamicteaserdfw.h" #include "matched_elements_filter_dfw.h" #include "positionsdfw.h" #include "rankfeaturesdfw.h" @@ -45,7 +45,7 @@ void throw_if_nullptr(const std::unique_ptr<DocsumFieldWriter>& writer, const vespalib::string& command) { - if (writer.get() == nullptr) { + if ( ! writer) { throw IllegalArgumentException("Failed to create docsum field writer for command '" + command + "'."); } } @@ -67,12 +67,7 @@ DocsumFieldWriterFactory::create_docsum_field_writer(const vespalib::string& fie std::unique_ptr<DocsumFieldWriter> fieldWriter; if (command == command::dynamic_teaser) { if ( ! source.empty() ) { - auto fw = std::make_unique<DynamicTeaserDFW>(getEnvironment().getJuniper()); - auto fw_ptr = fw.get(); - fieldWriter = std::move(fw); - if (!fw_ptr->Init(field_name.c_str(), source, _query_term_filter_factory)) { - throw IllegalArgumentException("Failed to initialize DynamicTeaserDFW."); - } + fieldWriter = std::make_unique<DynamicTeaserDFW>(getEnvironment().getJuniper(), field_name.c_str(), source, _query_term_filter_factory); } else { throw_missing_source(command); } |