21 #ifndef XAPIAN_INCLUDED_HONEY_SPELLING_H
22 #define XAPIAN_INCLUDED_HONEY_SPELLING_H
32 #include <string_view>
48 return std::string(word);
66 operator std::string()
const {
71 return std::memcmp(
data, b.
data, 4) < 0;
81 mutable std::map<std::string,
189 unsigned char first_ch = key[0];
void set_wordfreq_upper_bound(Xapian::termcount ub)
void merge_changes()
Merge in batched-up changes.
std::map< Honey::fragment, std::set< std::string > > termlist_deltas
Changes to make to the termlists.
std::map< std::string, Xapian::termcount, std::less<> > wordfreq_changes
void toggle_word(const std::string &word)
Xapian::termcount remove_word(const std::string &word, Xapian::termcount freqdec)
HoneySpellingTable(int fd, off_t offset_, bool readonly)
HoneySpellingTable(const std::string &dbdir, bool readonly)
Create a new HoneySpellingTable object.
void toggle_fragment(Honey::fragment frag, const std::string &word)
bool is_modified() const
Override methods of HoneyTable.
TermList * open_termlist(std::string_view word)
Xapian::termcount flush_db()
Returns updated wordfreq upper bound.
void cancel(const Honey::RootInfo &root_info, honey_revision_number_t rev)
Override methods of HoneyTable.
Xapian::doccount get_word_frequency(std::string_view word) const
void add_word(const std::string &word, Xapian::termcount freqinc)
Xapian::termcount wordfreq_upper_bound
Used to track an upper bound on wordfreq.
The list of words containing a particular trigram.
TermList * next()
Advance the current position to the next term in the termlist.
Xapian::termcount positionlist_count() const
Return the length of the position list for the current position.
HoneySpellingTermList(const HoneySpellingTermList &)
Copying is not allowed.
Xapian::termcount get_wdf() const
Return the wdf for the term at the current position.
int tail
Number of constant characters on the end of the value.
PositionList * positionlist_begin() const
Return PositionList for the current position.
HoneySpellingTermList(const std::string &data_)
Constructor.
unsigned p
Position in the data.
HoneySpellingTermList(const std::string &data_, const char *key)
Constructor for head/bookend/tail terms.
std::string data
The encoded data.
TermList * skip_to(std::string_view term)
Skip forward to the specified term.
Xapian::doccount get_termfreq() const
Return the term frequency for the term at the current position.
Xapian::termcount get_approx_size() const
Return approximate size of this termlist.
void operator=(const HoneySpellingTermList &)
Assignment is not allowed.
void cancel(const Honey::RootInfo &, honey_revision_number_t)
Abstract base class for iterating term positions in a document.
Abstract base class for termlists.
std::string current_term
The current term.
uint4 honey_revision_number_t
The revision number of a honey database.
Subclass of HoneyTable for deriving lazy tables from.
const unsigned KEY_PREFIX_WORD
const unsigned KEY_PREFIX_MIDDLE
const unsigned KEY_PREFIX_TAIL
std::string make_spelling_wordlist_key(std::string_view word)
const unsigned KEY_PREFIX_BOOKEND
const unsigned KEY_PREFIX_HEAD
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
XAPIAN_REVISION_TYPE rev
Revision number of a database.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
#define AssertRel(A, REL, B)
char & operator[](unsigned i)
fragment(char data_[4])
Allow implicit conversion.
bool operator<(const fragment &b) const
fragment()
Default constructor.
fragment(int)
Zero-initialising constructor.
const char & operator[](unsigned i) const
Abstract base class for termlists.