195 db.add_database(db2);
197 TEST_EQUAL(db.get_spelling_suggestion(
"hello"),
"");
198 TEST_EQUAL(db.get_spelling_suggestion(
"hell"),
"hello");
200 TEST_EQUAL(db2.get_spelling_suggestion(
"hell"),
"hello");
212 i = db2.spellings_begin();
219 TEST(i == db2.spellings_end());
221 i = db.spellings_begin();
231 TEST(i == db.spellings_end());
234 i = db.spellings_begin();
236 TEST(i != db.spellings_end());
240 TEST(i == db.spellings_end());
262 #define TARGET "\xe4\xb8\x80\xe4\xba\x9b"
DEFINE_TESTCASE(spell0,(spelling||remote) &&writable)
Xapian::Database get_writable_database_as_database()
Xapian::WritableDatabase get_writable_database(const string &dbname)
Xapian::Database get_database(const string &dbname)
test functionality of the Xapian API
An indexed database of documents.
Xapian::TermIterator spellings_begin() const
An iterator which returns all the spelling correction targets.
Xapian::TermIterator spellings_end() const noexcept
End iterator corresponding to spellings_begin().
void add_database(const Database &other)
Add shards from another Database.
std::string get_spelling_suggestion(std::string_view word, unsigned max_edit_distance=2) const
Suggest a spelling correction.
Class for iterating over a list of terms.
void skip_to(std::string_view term)
Advance the iterator to term term.
Xapian::doccount get_termfreq() const
Return the term frequency for the term at the current position.
This class provides read/write access to a database.
void add_spelling(std::string_view word, Xapian::termcount freqinc=1) const
Add a word to the spelling dictionary.
termcount remove_spelling(std::string_view word, termcount freqdec=1) const
Remove a word from the spelling dictionary.
void commit()
Commit pending modifications.
a generic test suite engine
#define TEST_EQUAL(a, b)
Test for equality of two things.
#define TEST(a)
Test a condition, without an additional explanation for failure.
Xapian-specific test helper functions and macros.
Public interfaces for the Xapian library.