-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvIndex.h
42 lines (25 loc) · 983 Bytes
/
InvIndex.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
#ifndef INVINDEX_H
#define INVINDEX_H
#include <boost/dynamic_bitset.hpp>
class InvIndex {
private:
struct WordInfo {
boost::dynamic_bitset bitset;
vector <int> overflow;
boost::mutex mutex;
};
typedef map <string, int> WordMap;
WordMap wordMap;
vector <WordInfo *> wordVec; // makes overhead of storing a lot of these neglibible - idea is not to resize as then we have to lock to check
boost::mutex vecMutex; // to resize vec
boost::mutex wordMapMutex; // to resize vec
int maxWordId;
//vector <boost::dynamic_bitset> bitsets;
//vector <vector<int> > overflow;
//vector <boost::mutex> wordMutexes;
public:
InvIndex(const size_t arraySize);
insertDoc(int docId, const vector <int> &wordIds);
insertDoc(int docId, const vector <string> &words); // will need map to do this
};
#endif