-
Notifications
You must be signed in to change notification settings - Fork 4
/
be_indexer.h
59 lines (39 loc) · 1.23 KB
/
be_indexer.h
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
#ifndef _LT_COMPONENT_BOOLEAN_INDEXER_H_
#define _LT_COMPONENT_BOOLEAN_INDEXER_H_
#include <algorithm>
#include <cassert>
#include <set>
#include <sstream>
#include <unordered_map>
#include "document.h"
#include "id_generator.h"
#include "posting_list.h"
#include "scanner_cursor.h"
namespace component {
class IndexScanner;
class BeIndexerBuilder;
class BooleanIndexer {
public:
BooleanIndexer();
~BooleanIndexer();
void DumpIndex(std::ostringstream& oss) const;
FieldCursorPtr GenWildcardCursor() const;
FieldMeta* GetMeta(const std::string& field) const;
EntriesContainer* GetContainer(const std::string field) const;
private:
friend IndexScanner;
friend BeIndexerBuilder;
bool SetMeta(const std::string& field, FieldMetaPtr meta);
bool CompleteIndex();
void AddWildcardEntry(const EntryId eid);
private:
Entries wildcard_list_;
std::map<std::string, FieldMetaPtr> field_meta_;
// here register a speical key: ___default___ as the
// default container for fields without specifing container
std::map<std::string, EntriesContainerPtr> containers_;
};
using RefBooleanIndexer = std::shared_ptr<BooleanIndexer>;
using BooleanIndexerPtr = std::unique_ptr<BooleanIndexer>;
} // namespace component
#endif