blob: 8de239975ce25852d24af05a7b7c7f10fe741981 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "i_reprocessing_handler.h"
#include "i_reprocessing_initializer.h"
#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchcore/proton/attribute/i_attribute_manager.h>
#include <vespa/searchcore/proton/common/i_document_type_inspector.h>
#include <vespa/searchlib/common/serialnum.h>
namespace proton {
class IIndexschemaInspector;
/**
* Class responsible for initialize reprocessing of attribute vectors if needed.
*
* 1) Attribute aspect is added to an existing field:
* The attribute is populated based on the content of the field in the document store.
*
* 2) Attribute aspect is removed from an existing field:
* The field in the document store is populated based on the content of the attribute.
*/
class AttributeReprocessingInitializer : public IReprocessingInitializer
{
public:
using UP = std::unique_ptr<AttributeReprocessingInitializer>;
class Config
{
private:
proton::IAttributeManager::SP _attrMgr;
const search::index::Schema &_schema;
public:
Config(const proton::IAttributeManager::SP &attrMgr,
const search::index::Schema &schema)
: _attrMgr(attrMgr),
_schema(schema)
{
}
const proton::IAttributeManager::SP &getAttrMgr() const { return _attrMgr; }
const search::index::Schema &getSchema() const { return _schema; }
};
private:
IReprocessingReader::SP _attrsToPopulate;
std::vector<IReprocessingRewriter::SP> _fieldsToPopulate;
public:
AttributeReprocessingInitializer(const Config &newCfg,
const Config &oldCfg,
const IDocumentTypeInspector &inspector,
const IIndexschemaInspector &oldIndexschemaInspector,
const vespalib::string &subDbName,
search::SerialNum serialNum);
// Implements IReprocessingInitializer
virtual bool hasReprocessors() const override;
virtual void initialize(IReprocessingHandler &handler) override;
};
} // namespace proton
|