37 #include <string_view>
46 if (!postlist_table.is_open())
53 "Xapian::DB_READONLY_ should imply Xapian::DB_NO_TERMLIST");
56 :
Xapian::Database::Internal(TRANSACTION_READONLY),
59 docdata_table(path,
true),
60 postlist_table(path,
true),
61 position_table(path,
true),
62 spelling_table(path,
true),
63 synonym_table(path,
true),
67 value_manager(postlist_table, termlist_table)
80 :
Xapian::Database::Internal(TRANSACTION_READONLY),
82 docdata_table(fd, version_file.get_offset(),
true),
83 postlist_table(fd, version_file.get_offset(),
true),
84 position_table(fd, version_file.get_offset(),
true),
85 spelling_table(fd, version_file.get_offset(),
true),
86 synonym_table(fd, version_file.get_offset(),
true),
89 termlist_table(fd, version_file.get_offset(),
true,
91 value_manager(postlist_table, termlist_table)
158 string message =
"Document ID not in use: ";
176 while (termlist.
next() == NULL) {
178 if (current_wdf > max_wdf) max_wdf = current_wdf;
227 if (
usual(wdf_bound != 0)) {
302 if (tl->
size() == 0) {
310 unique_ptr<TermList> tl_ptr(tl);
359 if (
rare(cursor == NULL)) {
399 if (
rare(cursor == NULL)) {
520 string desc =
"Honey(";
static Xapian::Query query(Xapian::Query::op op, const string &t1=string(), const string &t2=string(), const string &t3=string(), const string &t4=string(), const string &t5=string(), const string &t6=string(), const string &t7=string(), const string &t8=string(), const string &t9=string(), const string &t10=string())
A PostList iterating all docids when they form a contiguous range.
bool find_entry_ge(std::string_view key)
Xapian::termcount get_doclength_lower_bound() const
Get a lower bound on the length of a document in this DB.
HoneyCursor * doclen_cursor
Xapian::doccount get_spelling_frequency(std::string_view word) const
Return the number of times word was added as a spelling.
void add_spelling(std::string_view word, Xapian::termcount freqinc) const
Add a word to the spelling dictionary.
HoneySpellingTable spelling_table
void get_freqs(std::string_view term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const
Returns frequencies for a term.
Honey::DocLenChunkReader doclen_chunk_reader
HoneyCursor * get_postlist_cursor() const
TermList * open_spelling_wordlist() const
Return a termlist which returns the words which are spelling correction targets.
std::string path
Path of the directory.
void add_synonym(std::string_view term, std::string_view synonym) const
Add a synonym for a term.
HoneyVersion version_file
Version file ("iamhoney").
HoneyPostListTable postlist_table
std::string get_value_upper_bound(Xapian::valueno slot) const
Get an upper bound on the values stored in the given value slot.
void remove_synonym(std::string_view term, std::string_view synonym) const
Remove a synonym for a term.
void request_document(Xapian::docid did) const
Request a document.
Xapian::Document::Internal * open_document(Xapian::docid did, bool lazy) const
Open a handle on a document.
std::string get_value_lower_bound(Xapian::valueno slot) const
Get a lower bound on the values stored in the given value slot.
PositionList * open_position_list(Xapian::docid did, std::string_view term) const
HoneyTermListTable termlist_table
int get_backend_info(std::string *path) const
Get backend information about this database.
bool reopen()
Reopen the database to the latest available revision.
TermList * open_synonym_termlist(std::string_view term) const
Open a termlist returning synonyms for a term.
std::string get_description() const
Return a string describing this object.
Xapian::termcount remove_spelling(std::string_view word, Xapian::termcount freqdec) const
Remove a word from the spelling dictionary.
TermList * open_allterms(std::string_view prefix) const
Xapian::termcount get_doclength(Xapian::docid did) const
void close()
Close the database.
Xapian::termcount get_unique_terms_upper_bound() const
Get an upper bound on the unique terms size of a document in this DB.
TermList * open_metadata_keylist(std::string_view prefix) const
Open a termlist returning each metadata key.
Xapian::termcount get_wdfdocmax(Xapian::docid did) const
Get the max wdf in document.
friend class HoneySpellingWordsList
std::string get_metadata(std::string_view key) const
Get the metadata associated with a given key.
void get_used_docid_range(Xapian::docid &first, Xapian::docid &last) const
Find lowest and highest docids actually in use.
HoneySynonymTable synonym_table
friend class HoneyTermList
Xapian::docid get_lastdocid() const
Return the last used document id of this (sub) database.
HoneyValueManager value_manager
friend class HoneyAllTermsList
HoneyPositionTable position_table
std::string get_uuid() const
Get a UUID for the database.
Xapian::termcount get_wdf_upper_bound(std::string_view term) const
Get an upper bound on the wdf of term term.
PostList * open_post_list(std::string_view term) const
Return a PostList suitable for use in a PostingIterator.
Xapian::termcount get_unique_terms_lower_bound() const
Get a lower bound on the unique terms size of a document in this DB.
Xapian::rev get_revision() const
Get the current revision of the database.
TermList * open_term_list_direct(Xapian::docid did) const
Like open_term_list() but without MultiTermList wrapper.
TermList * open_synonym_keylist(std::string_view prefix) const
Open a termlist returning each term which has synonyms.
void throw_termlist_table_close_exception() const
Xapian::termcount get_doclength_upper_bound() const
Get an upper bound on the length of a document in this DB.
bool has_positions() const
Check whether this database contains any positional information.
HoneyDocDataTable docdata_table
TermList * open_term_list(Xapian::docid did) const
void set_metadata(std::string_view key, std::string_view value)
Set the metadata associated with a given key.
void readahead_for_query(const Xapian::Query &query) const
ValueList * open_value_list(Xapian::valueno slot) const
Open a value stream.
LeafPostList * open_leaf_post_list(std::string_view term, bool need_read_pos) const
Create a LeafPostList for use during a match.
Xapian::doccount get_value_freq(Xapian::valueno slot) const
Return the frequency of a given value slot.
HoneyDatabase(const HoneyDatabase &)=delete
Don't allow copying.
bool term_exists(std::string_view term) const
Xapian::doccount get_doccount() const
Xapian::totallength get_total_length() const
Return the total length of all documents in this database.
friend class HoneySynonymTermList
void clear_synonyms(std::string_view term) const
Clear all synonyms for a term.
Xapian::termcount get_unique_terms(Xapian::docid did) const
Get the number of unique terms in document.
TermList * open_spelling_termlist(std::string_view word) const
Create a termlist tree from trigrams of word.
A document read from a HoneyDatabase.
HoneyPositionList * open_position_list(Xapian::docid did, std::string_view term) const
void get_used_docid_range(Xapian::doccount doccount, Xapian::docid &first, Xapian::docid &last) const
bool term_exists(std::string_view term) const
void get_freqs(std::string_view term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const
HoneyPostList * open_post_list(const HoneyDatabase *db, std::string_view term, bool need_read_pos) const
Xapian::termcount get_wdf_upper_bound(std::string_view term) const
std::string get_metadata(std::string_view key) const
TermList * open_termlist(std::string_view word)
Xapian::doccount get_word_frequency(std::string_view word) const
TermList * open_termlist(std::string_view term) const
Open synonym termlist for a term.
HoneyCursor * cursor_get() const
void close(bool permanent)
static void throw_database_closed()
void open(int flags_, const Honey::RootInfo &root_info, honey_revision_number_t)
A TermList in a honey database.
Xapian::termcount get_wdf() const
Return the wdf for the term at the current position.
TermList * next()
Advance the current position to the next term in the termlist.
Xapian::termcount size() const
Return the number of entries in this termlist.
Honey class for value streams.
std::string get_value_upper_bound(Xapian::valueno slot) const
std::string get_value_lower_bound(Xapian::valueno slot) const
Xapian::doccount get_value_freq(Xapian::valueno slot) const
std::string get_uuid_string() const
Return UUID in the standard 36 character string format.
Xapian::termcount get_doclength_lower_bound() const
Xapian::docid get_last_docid() const
Xapian::totallength get_total_doclen() const
Xapian::termcount get_unique_terms_upper_bound() const
Xapian::termcount get_unique_terms_lower_bound() const
honey_revision_number_t get_revision() const
void read()
Read the version file and check it's a version we understand.
Xapian::termcount get_wdf_upper_bound() const
Xapian::doccount get_doccount() const
Xapian::termcount get_doclength_upper_bound() const
const Honey::RootInfo & get_root(Honey::table_type tbl) const
Xapian::termcount back()
Return the last document length in this chunk.
bool find_doclength(Xapian::docid target)
Searches the whole chunk (skip_to() only advances).
bool update(HoneyCursor *cursor)
Update to use the chunk currently pointed to by cursor.
Xapian::termcount get_doclength() const
Abstract base class for leaf postlists.
Indicates an attempt to access a document not present in the database.
Abstract base class for a document.
Indicates an attempt to use a feature which is unavailable.
Abstract base class for postlists.
Abstract base class for iterating term positions in a document.
Class representing a query.
Abstract base class for termlists.
UnimplementedError indicates an attempt to use an unimplemented feature.
Abstract base class for value streams.
Iterate all document ids when they form a contiguous range.
Hierarchy of classes which Xapian can throw as exceptions.
A termlist containing all terms in a honey database.
Database using honey backend.
A document read from a HoneyDatabase.
A termlist containing all words which are spelling targets.
A TermList in a honey database.
Honey class for value streams.
Abstract base class for leaf postlists.
std::string make_doclenchunk_key(Xapian::docid last_did)
Generate a key for a doclen chunk.
string str(int value)
Convert int to std::string.
The Xapian namespace contains public interfaces for the Xapian library.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
XAPIAN_REVISION_TYPE rev
Revision number of a database.
unsigned valueno
The number for a value slot in a document.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
const int DB_NO_TERMLIST
When creating a database, don't create a termlist table.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
XAPIAN_TOTALLENGTH_TYPE totallength
The total length of all documents in a database.