forked from Mirrors/privacore-open-source-search-engine
37 lines
852 B
C++
37 lines
852 B
C++
#ifndef GB_HIGHFREQUENCYTERMSHORTCUTS_H
|
|
#define GB_HIGHFREQUENCYTERMSHORTCUTS_H
|
|
|
|
#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;
|
|
};
|
|
std::map<uint64_t,TermEntry> entries;
|
|
void *buffer;
|
|
public:
|
|
HighFrequencyTermShortcuts()
|
|
: entries()
|
|
{ }
|
|
~HighFrequencyTermShortcuts()
|
|
{ }
|
|
|
|
bool load();
|
|
void unload();
|
|
|
|
bool empty() const { return entries.empty(); }
|
|
|
|
bool query_term_shortcut(uint64_t term_id, const void **posdb_entries, size_t *bytes);
|
|
};
|
|
|
|
extern HighFrequencyTermShortcuts g_hfts;
|
|
|
|
#endif // GB_HIGHFREQUENCYTERMSHORTCUTS_H
|