|
xapian-core
2.0.0
|
#include <honey_spelling.h>
Inheritance diagram for HoneySpellingTable:
Collaboration diagram for HoneySpellingTable:Public Member Functions | |
| HoneySpellingTable (const std::string &dbdir, bool readonly) | |
| Create a new HoneySpellingTable object. More... | |
| HoneySpellingTable (int fd, off_t offset_, bool readonly) | |
| void | merge_changes () |
| Merge in batched-up changes. More... | |
| void | add_word (const std::string &word, Xapian::termcount freqinc) |
| Xapian::termcount | remove_word (const std::string &word, Xapian::termcount freqdec) |
| TermList * | open_termlist (std::string_view word) |
| Xapian::doccount | get_word_frequency (std::string_view word) const |
| void | set_wordfreq_upper_bound (Xapian::termcount ub) |
| bool | is_modified () const |
| Override methods of HoneyTable. More... | |
| Xapian::termcount | flush_db () |
| Returns updated wordfreq upper bound. More... | |
| void | cancel (const Honey::RootInfo &root_info, honey_revision_number_t rev) |
| Override methods of HoneyTable. More... | |
Public Member Functions inherited from HoneyLazyTable | |
| HoneyLazyTable (const char *name_, const std::string &path_, bool readonly) | |
| Create a new lazy table. More... | |
| HoneyLazyTable (const char *name_, int fd, off_t offset_, bool readonly) | |
Public Member Functions inherited from HoneyTable | |
| HoneyTable (const char *, const std::string &path_, bool read_only_, bool lazy_=false) | |
| HoneyTable (const char *, int fd, off_t offset_, bool read_only_, bool lazy_=false) | |
| ~HoneyTable () | |
| bool | is_writable () const |
| int | get_flags () const |
| void | create_and_open (int flags_, const Honey::RootInfo &root_info) |
| void | open (int flags_, const Honey::RootInfo &root_info, honey_revision_number_t) |
| void | close (bool permanent) |
| const std::string & | get_path () const |
| void | add (std::string_view key, const char *val, size_t val_size, bool compressed=false) |
| void | add (std::string_view key, std::string_view val, bool compressed=false) |
| void | flush_db () |
| void | cancel (const Honey::RootInfo &, honey_revision_number_t) |
| void | commit (honey_revision_number_t, Honey::RootInfo *root_info) |
| bool | sync () |
| bool | empty () const |
| bool | get_exact_entry (std::string_view key, std::string &tag) const |
| bool | key_exists (const std::string &key) const |
| bool | del (const std::string &) |
| bool | readahead_key (const std::string &) const |
| bool | is_modified () const |
| HoneyCursor * | cursor_get () const |
| bool | exists () const |
| bool | is_open () const |
| honey_tablesize_t | get_entry_count () const |
| honey_tablesize_t | get_approx_entry_count () const |
| Return an approximation of the number of entries in the table. More... | |
| off_t | get_root () const |
| off_t | get_offset () const |
Private Member Functions | |
| void | toggle_word (const std::string &word) |
| void | toggle_fragment (Honey::fragment frag, const std::string &word) |
Private Attributes | |
| std::map< std::string, Xapian::termcount, std::less<> > | wordfreq_changes |
| std::map< Honey::fragment, std::set< std::string > > | termlist_deltas |
| Changes to make to the termlists. More... | |
| Xapian::termcount | wordfreq_upper_bound = 0 |
| Used to track an upper bound on wordfreq. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from HoneyTable | |
| static void | throw_database_closed () |
Definition at line 77 of file honey_spelling.h.
|
inline |
Create a new HoneySpellingTable object.
This method does not create or open the table on disk - you must call the create() or open() methods respectively!
| dbdir | The directory the honey database is stored in. |
| readonly | true if we're opening read-only, else false. |
Definition at line 107 of file honey_spelling.h.
|
inline |
Definition at line 110 of file honey_spelling.h.
| void HoneySpellingTable::add_word | ( | const std::string & | word, |
| Xapian::termcount | freqinc | ||
| ) |
Definition at line 129 of file honey_spelling.cc.
References Honey::make_spelling_wordlist_key(), p, and unpack_uint_last().
|
inline |
Override methods of HoneyTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Definition at line 146 of file honey_spelling.h.
References HoneyTable::cancel(), termlist_deltas, and wordfreq_changes.
|
inline |
Returns updated wordfreq upper bound.
Definition at line 140 of file honey_spelling.h.
References HoneyTable::flush_db(), merge_changes(), and wordfreq_upper_bound.
| Xapian::doccount HoneySpellingTable::get_word_frequency | ( | std::string_view | word | ) | const |
Definition at line 355 of file honey_spelling.cc.
References Honey::make_spelling_wordlist_key(), p, and unpack_uint_last().
Referenced by HoneyDatabase::get_spelling_frequency().
|
inline |
Override methods of HoneyTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Definition at line 135 of file honey_spelling.h.
References HoneyTable::is_modified(), and wordfreq_changes.
| void HoneySpellingTable::merge_changes | ( | ) |
Merge in batched-up changes.
Definition at line 46 of file honey_spelling.cc.
References PrefixCompressedStringWriter::append(), Assert, PrefixCompressedStringItor::at_end(), Honey::make_spelling_wordlist_key(), and pack_uint_last().
Referenced by flush_db().
| TermList * HoneySpellingTable::open_termlist | ( | std::string_view | word | ) |
Definition at line 261 of file honey_spelling.cc.
References AssertRel, Honey::fragment::data, Honey::KEY_PREFIX_BOOKEND, Honey::KEY_PREFIX_HEAD, Honey::KEY_PREFIX_MIDDLE, Honey::KEY_PREFIX_TAIL, and make_termlist_merger().
Referenced by HoneyDatabase::open_spelling_termlist().
| Xapian::termcount HoneySpellingTable::remove_word | ( | const std::string & | word, |
| Xapian::termcount | freqdec | ||
| ) |
Definition at line 163 of file honey_spelling.cc.
References Honey::make_spelling_wordlist_key(), p, and unpack_uint_last().
|
inline |
Definition at line 124 of file honey_spelling.h.
References wordfreq_upper_bound.
|
private |
Definition at line 113 of file honey_spelling.cc.
|
private |
Definition at line 211 of file honey_spelling.cc.
References Honey::fragment::data, Honey::KEY_PREFIX_BOOKEND, Honey::KEY_PREFIX_HEAD, Honey::KEY_PREFIX_MIDDLE, and Honey::KEY_PREFIX_TAIL.
|
mutableprivate |
Changes to make to the termlists.
This list is essentially xor-ed with the list on disk, so an entry here either means a new entry needs to be added on disk, or an existing entry on disk needs to be removed. We do it this way so we don't need to store an additional add/remove flag for every word.
Definition at line 93 of file honey_spelling.h.
Referenced by cancel().
|
mutableprivate |
Definition at line 83 of file honey_spelling.h.
Referenced by cancel(), and is_modified().
|
private |
Used to track an upper bound on wordfreq.
Definition at line 96 of file honey_spelling.h.
Referenced by flush_db(), and set_wordfreq_upper_bound().