2016-03-08 22:14:30 +01:00
|
|
|
#ifndef GB_HIGHFREQUENCYTERMSHORTCUTS_H
|
|
|
|
#define GB_HIGHFREQUENCYTERMSHORTCUTS_H
|
2016-01-21 17:24:01 +01:00
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <map>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
//A set of PosDB shortcuts for high-frequency terms, aka stop words
|
|
|
|
class HighFrequencyTermShortcuts {
|
|
|
|
HighFrequencyTermShortcuts(const HighFrequencyTermShortcuts&);
|
|
|
|
HighFrequencyTermShortcuts& operator=(const HighFrequencyTermShortcuts&);
|
|
|
|
|
|
|
|
struct TermEntry {
|
|
|
|
const void *p;
|
|
|
|
size_t bytes;
|
2016-11-04 14:35:40 +01:00
|
|
|
char start_key[18];
|
|
|
|
char end_key[18];
|
2016-01-21 17:24:01 +01:00
|
|
|
};
|
|
|
|
std::map<uint64_t,TermEntry> entries;
|
|
|
|
void *buffer;
|
|
|
|
public:
|
2016-09-22 22:01:39 +02:00
|
|
|
HighFrequencyTermShortcuts() : entries() {
|
|
|
|
buffer=NULL;
|
|
|
|
}
|
|
|
|
|
2016-01-21 17:24:01 +01:00
|
|
|
~HighFrequencyTermShortcuts()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bool load();
|
|
|
|
void unload();
|
|
|
|
|
|
|
|
bool empty() const { return entries.empty(); }
|
|
|
|
|
2016-11-04 14:35:40 +01:00
|
|
|
bool query_term_shortcut(uint64_t term_id,
|
|
|
|
const void **posdb_entries, size_t *bytes,
|
|
|
|
void *start_key, void *end_key);
|
2017-02-13 16:44:34 +01:00
|
|
|
|
|
|
|
bool is_registered_term(uint64_t term_id);
|
2016-01-21 17:24:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern HighFrequencyTermShortcuts g_hfts;
|
|
|
|
|
2016-03-08 22:14:30 +01:00
|
|
|
#endif // GB_HIGHFREQUENCYTERMSHORTCUTS_H
|