#include <flint_spelling.h>


Public Member Functions | |
| FlintSpellingTable (const std::string &dbdir, bool readonly) | |
| Create a new FlintSpellingTable object. | |
| void | merge_changes () |
| void | add_word (const std::string &word, Xapian::termcount freqinc) |
| void | remove_word (const std::string &word, Xapian::termcount freqdec) |
| TermList * | open_termlist (const std::string &word) |
| Xapian::doccount | get_word_frequency (const std::string &word) const |
| bool | is_modified () const |
| Override methods of FlintTable. | |
| void | create_and_open (unsigned int blocksize) |
| Override methods of FlintTable. | |
| void | flush_db () |
| Override methods of FlintTable. | |
| void | cancel () |
| Override methods of FlintTable. | |
Private Member Functions | |
| void | toggle_word (const std::string &word) |
| void | toggle_fragment (F_fragment frag, const std::string &word) |
Private Attributes | |
| std::map< std::string, Xapian::termcount > | wordfreq_changes |
| std::map< F_fragment, std::set < std::string > > | termlist_deltas |
| Changes to make to the termlists. | |
Definition at line 55 of file flint_spelling.h.
| FlintSpellingTable::FlintSpellingTable | ( | const std::string & | dbdir, | |
| bool | readonly | |||
| ) | [inline] |
Create a new FlintSpellingTable 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 flint database is stored in. | |
| readonly | true if we're opening read-only, else false. |
Definition at line 80 of file flint_spelling.h.
| void FlintSpellingTable::add_word | ( | const std::string & | word, | |
| Xapian::termcount | freqinc | |||
| ) |
Definition at line 124 of file flint_spelling.cc.
References F_unpack_uint_last(), FlintTable::get_exact_entry(), toggle_word(), and wordfreq_changes.
Referenced by FlintWritableDatabase::add_spelling().
| void FlintSpellingTable::cancel | ( | ) | [inline] |
Override methods of FlintTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters).
Reimplemented from FlintTable.
Definition at line 116 of file flint_spelling.h.
References termlist_deltas, and wordfreq_changes.
Referenced by FlintDatabase::cancel().
| void FlintSpellingTable::create_and_open | ( | unsigned int | blocksize | ) | [inline] |
Override methods of FlintTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters).
Reimplemented from FlintTable.
Definition at line 104 of file flint_spelling.h.
References FlintTable::erase(), and FlintTable::set_block_size().
Referenced by FlintDatabase::create_and_open_tables().
| void FlintSpellingTable::flush_db | ( | ) | [inline] |
Override methods of FlintTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters).
Reimplemented from FlintTable.
Definition at line 111 of file flint_spelling.h.
References merge_changes().
Referenced by FlintDatabase::set_revision_number().
| Xapian::doccount FlintSpellingTable::get_word_frequency | ( | const std::string & | word | ) | const |
Definition at line 369 of file flint_spelling.cc.
References F_unpack_uint_last(), FlintTable::get_exact_entry(), and wordfreq_changes.
Referenced by FlintDatabase::get_spelling_frequency().
| bool FlintSpellingTable::is_modified | ( | ) | const [inline] |
Override methods of FlintTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters).
Reimplemented from FlintTable.
Definition at line 100 of file flint_spelling.h.
References wordfreq_changes.
Referenced by FlintDatabase::apply().
| void FlintSpellingTable::merge_changes | ( | ) |
Definition at line 44 of file flint_spelling.cc.
References FlintTable::add(), PrefixCompressedStringWriter::append(), Assert, PrefixCompressedStringItor::at_end(), FlintTable::del(), F_pack_uint_last(), FlintTable::get_exact_entry(), termlist_deltas, and wordfreq_changes.
Referenced by flush_db(), FlintWritableDatabase::open_spelling_wordlist(), and open_termlist().
| TermList * FlintSpellingTable::open_termlist | ( | const std::string & | word | ) |
Definition at line 253 of file flint_spelling.cc.
References Assert, AssertRel, F_fragment::data, FlintTable::get_exact_entry(), merge_changes(), and wordfreq_changes.
Referenced by FlintDatabase::open_spelling_termlist().
| void FlintSpellingTable::remove_word | ( | const std::string & | word, | |
| Xapian::termcount | freqdec | |||
| ) |
Definition at line 159 of file flint_spelling.cc.
References F_unpack_uint_last(), FlintTable::get_exact_entry(), toggle_word(), and wordfreq_changes.
Referenced by FlintWritableDatabase::remove_spelling().
| void FlintSpellingTable::toggle_fragment | ( | F_fragment | frag, | |
| const std::string & | word | |||
| ) | [private] |
Definition at line 108 of file flint_spelling.cc.
References termlist_deltas.
Referenced by toggle_word().
| void FlintSpellingTable::toggle_word | ( | const std::string & | word | ) | [private] |
Definition at line 203 of file flint_spelling.cc.
References F_fragment::data, and toggle_fragment().
Referenced by add_word(), and remove_word().
std::map<F_fragment, std::set<std::string> > FlintSpellingTable::termlist_deltas [private] |
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 69 of file flint_spelling.h.
Referenced by cancel(), merge_changes(), and toggle_fragment().
std::map<std::string, Xapian::termcount> FlintSpellingTable::wordfreq_changes [private] |
Definition at line 59 of file flint_spelling.h.
Referenced by add_word(), cancel(), get_word_frequency(), is_modified(), merge_changes(), open_termlist(), and remove_word().