blob: 0eca882836b678fda22f62da9277da898bbe99cd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "push_task.h"
#include "push_context.h"
#include "field_inverter.h"
#include "url_field_inverter.h"
namespace search::memoryindex {
namespace {
template <typename Inverter>
void push_inverter(Inverter& inverter)
{
inverter.applyRemoves();
inverter.pushDocuments();
}
}
PushTask::PushTask(const PushContext& context, const std::vector<std::unique_ptr<FieldInverter>>& inverters, const std::vector<std::unique_ptr<UrlFieldInverter>>& uri_inverters, std::shared_ptr<vespalib::IDestructorCallback> on_write_done, std::shared_ptr<vespalib::RetainGuard> retain)
: _context(context),
_inverters(inverters),
_uri_inverters(uri_inverters),
_on_write_done(std::move(on_write_done)),
_retain(std::move(retain))
{
}
PushTask::~PushTask() = default;
void
PushTask::run()
{
for (auto field_id : _context.get_fields()) {
push_inverter(*_inverters[field_id]);
}
for (auto uri_field_id : _context.get_uri_fields()) {
push_inverter(*_uri_inverters[uri_field_id]);
}
}
}
|