blob: 66fed0e4262f2da9de275965f288560279c3d5ca (
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
66
67
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "dictionary.h"
#include "fieldinverter.h"
#include <vespa/searchlib/bitcompression/posocccompression.h>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.memoryindex.dictionary");
#include <vespa/searchlib/btree/btreenode.hpp>
#include <vespa/searchlib/btree/btreenodeallocator.hpp>
#include <vespa/searchlib/btree/btreenodestore.hpp>
#include <vespa/searchlib/btree/btreestore.hpp>
#include <vespa/searchlib/btree/btreeiterator.hpp>
#include <vespa/searchlib/btree/btreeroot.hpp>
#include <vespa/searchlib/btree/btree.hpp>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/exceptions.h>
namespace search {
using index::DocIdAndFeatures;
using index::WordDocElementFeatures;
using index::Schema;
namespace memoryindex {
Dictionary::Dictionary(const Schema & schema)
: _fieldIndexes(),
_numFields(schema.getNumIndexFields())
{
for (uint32_t fieldId = 0; fieldId < _numFields; ++fieldId) {
auto fieldIndex = std::make_unique<MemoryFieldIndex>(schema, fieldId);
_fieldIndexes.push_back(std::move(fieldIndex));
}
}
Dictionary::~Dictionary()
{
}
void
Dictionary::dump(search::index::IndexBuilder &indexBuilder)
{
for (uint32_t fieldId = 0; fieldId < _numFields; ++fieldId) {
indexBuilder.startField(fieldId);
_fieldIndexes[fieldId]->dump(indexBuilder);
indexBuilder.endField();
}
}
MemoryUsage
Dictionary::getMemoryUsage() const
{
MemoryUsage usage;
for (auto &fieldIndex : _fieldIndexes) {
usage.merge(fieldIndex->getMemoryUsage());
}
return usage;
}
} // namespace search::memoryindex
} // namespace search
|