44 position_table.
pack(s, posvec);
45 if (modifying && has_positions_cache != 0) {
48 has_positions_cache = s.empty() ? -1 : 1;
50 auto i = pos_changes.find(
term);
51 if (i != pos_changes.end()) {
52 map<Xapian::docid, string>& m = i->second;
68 if (!s.empty()) has_positions_cache = 1;
70 set_positionlist(did,
term, s);
83 store_positions(position_table, did,
term, *ptr, modifying);
90 posvec.
reserve(
pos.internal->get_approx_size());
95 store_positions(position_table, did,
term, posvec, modifying);
101 delete_positionlist(did,
term);
109 has_positions_cache = s.empty() ? -1 : 1;
110 pos_changes.insert(make_pair(
term, map<Xapian::docid, string>()))
111 .first->second[did] = s;
118 set_positionlist(did,
term, {});
126 auto i = pos_changes.find(
term);
127 if (i == pos_changes.end())
129 const map<Xapian::docid, string>& m = i->second;
130 auto j = m.find(did);
140 if (has_positions_cache < 0) {
144 for (
const auto& i : pos_changes) {
145 const map<Xapian::docid, string>& m = i.second;
146 for (
const auto& j : m) {
147 const string& s = j.second;
157 return has_positions_cache;
164 doclen_changes.clear();
170 auto i = postlist_changes.find(
term);
171 if (i == postlist_changes.end())
return;
175 postlist_changes.erase(i);
181 for (
auto&& i : postlist_changes) {
184 postlist_changes.clear();
191 return flush_all_post_lists(table);
193 auto begin = postlist_changes.lower_bound(pfx);
197 if (pfxinc.back() !=
'\xff') {
199 end = postlist_changes.lower_bound(pfxinc);
202 pfxinc.resize(pfxinc.size() - 1);
203 if (pfxinc.empty()) {
204 end = postlist_changes.end();
209 for (
auto i = begin; i != end; ++i) {
215 postlist_changes.erase(begin, end);
221 flush_doclengths(table);
222 flush_all_post_lists(table);
228 for (
auto i : pos_changes) {
229 const string&
term = i.first;
230 const map<Xapian::docid, string>& m = i.second;
233 const string& s = j.second;
241 has_positions_cache = -1;
void delete_positionlist(Xapian::docid did, std::string_view term)
bool get_positionlist(Xapian::docid did, std::string_view term, std::string &s) const
void store_positions(const HoneyPositionTable &position_table, Xapian::docid did, std::string_view term, const Xapian::VecCOW< Xapian::termpos > &posvec, bool modifying)
bool has_positions(const HoneyPositionTable &position_table) const
void flush_pos_lists(HoneyPositionTable &table)
Flush position changes.
void flush(HoneyPostListTable &table)
Flush all postlist table changes.
void flush_post_list(HoneyPostListTable &table, std::string_view term)
Flush postlist changes for term.
void set_positionlist(Xapian::docid did, std::string_view term, std::string_view s)
void flush_all_post_lists(HoneyPostListTable &table)
Flush postlist changes for all terms.
void flush_doclengths(HoneyPostListTable &table)
Flush document length changes.
void flush_post_lists(HoneyPostListTable &table, std::string_view pfx)
Flush postlist changes for all terms which start with pfx.
static std::string make_key(Xapian::docid did, std::string_view term)
void set_positionlist(Xapian::docid did, std::string_view term, std::string_view s)
Set the position list for term term in document did.
void pack(std::string &s, const Xapian::VecCOW< Xapian::termpos > &vec) const
Pack a position list into a string.
void delete_positionlist(Xapian::docid did, std::string_view term)
Delete the position list for term term in document did.
void merge_changes(std::string_view term, const HoneyInverter::PostingChanges &changes)
void merge_doclen_changes(const std::map< Xapian::docid, Xapian::termcount > &changes)
bool get_exact_entry(std::string_view key, std::string *tag) const
honey_tablesize_t get_entry_count() const
Class for iterating over term positions.
virtual const Xapian::VecCOW< Xapian::termpos > * get_vec_termpos() const
Get pointer to VecCOW<termpos> if that's the internal representation.
Class for iterating over a list of terms.
PositionIterator positionlist_end() const noexcept
Return an end PositionIterator for the current term.
PositionIterator positionlist_begin() const
Return a PositionIterator for the current term.
Suitable for "simple" type T.
void reserve(size_type n)
unsigned long long honey_tablesize_t
How many entries there are in a table.
HoneyInverter class which "inverts the file".
A position list in a honey database.
PostList in a honey database.
Subclass of HoneyTable which holds postlists.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Abstract base class for termlists.