1 /** @file emptydatabase.h
2 * @brief Empty database internals
4 /* Copyright 2017 Olly Betts
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef XAPIAN_INCLUDED_EMPTY_DATABASE_H
22 #define XAPIAN_INCLUDED_EMPTY_DATABASE_H
24 #include "backends/databaseinternal.h"
26 /// Empty database internals.
27 class EmptyDatabase
: public Xapian::Database::Internal
{
29 EmptyDatabase() : Xapian::Database::Internal(TRANSACTION_NONE
) {}
31 size_type
size() const;
35 PostList
* open_post_list(const std::string
& term
) const;
37 LeafPostList
* open_leaf_post_list(const std::string
& term
,
40 TermList
* open_term_list(Xapian::docid did
) const;
42 TermList
* open_term_list_direct(Xapian::docid did
) const;
44 TermList
* open_allterms(const std::string
& prefix
) const;
46 bool has_positions() const;
48 PositionList
* open_position_list(Xapian::docid did
,
49 const std::string
& term
) const;
50 Xapian::doccount
get_doccount() const;
52 Xapian::docid
get_lastdocid() const;
54 Xapian::totallength
get_total_length() const;
56 void get_freqs(const std::string
& term
,
57 Xapian::doccount
* tf_ptr
,
58 Xapian::termcount
* cf_ptr
) const;
60 Xapian::doccount
get_value_freq(Xapian::valueno slot
) const;
62 std::string
get_value_lower_bound(Xapian::valueno slot
) const;
64 std::string
get_value_upper_bound(Xapian::valueno slot
) const;
66 Xapian::termcount
get_doclength_lower_bound() const;
68 Xapian::termcount
get_doclength_upper_bound() const;
70 Xapian::termcount
get_wdf_upper_bound(const std::string
& term
) const;
72 ValueList
* open_value_list(Xapian::valueno slot
) const;
74 Xapian::termcount
get_doclength(Xapian::docid did
) const;
76 Xapian::termcount
get_unique_terms(Xapian::docid did
) const;
78 Xapian::Document::Internal
* open_document(Xapian::docid did
,
81 bool term_exists(const std::string
& term
) const;
83 TermList
* open_spelling_termlist(const std::string
& word
) const;
85 TermList
* open_spelling_wordlist() const;
87 Xapian::doccount
get_spelling_frequency(const std::string
& word
) const;
89 TermList
* open_synonym_termlist(const std::string
& term
) const;
91 TermList
* open_synonym_keylist(const std::string
& prefix
) const;
93 std::string
get_metadata(const std::string
& key
) const;
95 TermList
* open_metadata_keylist(const std::string
& prefix
) const;
97 void write_changesets_to_fd(int fd
,
98 const std::string
& start_revision
,
100 Xapian::ReplicationInfo
* info
);
102 void invalidate_doc_object(Xapian::Document::Internal
* obj
) const;
104 Xapian::rev
get_revision() const;
106 int get_backend_info(std::string
* path
) const;
112 void begin_transaction(bool flushed
);
114 void end_transaction_(bool do_commit
);
116 Xapian::docid
add_document(const Xapian::Document
& doc
);
118 void delete_document(Xapian::docid did
);
120 void delete_document(const std::string
& term
);
122 void replace_document(Xapian::docid did
, const Xapian::Document
& doc
);
124 Xapian::docid
replace_document(const std::string
& term
,
125 const Xapian::Document
& doc
);
127 void add_spelling(const std::string
& word
, Xapian::termcount freqinc
) const;
129 Xapian::termcount
remove_spelling(const std::string
& word
,
130 Xapian::termcount freqdec
) const;
132 void add_synonym(const std::string
& term
, const std::string
& synonym
) const;
134 void remove_synonym(const std::string
& term
,
135 const std::string
& synonym
) const;
137 void clear_synonyms(const std::string
& term
) const;
139 void set_metadata(const std::string
& key
, const std::string
& value
);
141 std::string
get_description() const;
144 #endif // XAPIAN_INCLUDED_EMPTY_DATABASE_H