43 position_table.
pack(s, posvec);
44 if (modifying && has_positions_cache != 0) {
47 has_positions_cache = s.empty() ? -1 : 1;
49 auto i = pos_changes.find(tname);
50 if (i != pos_changes.end()) {
51 map<Xapian::docid, string> & m = i->second;
59 const string & key = position_table.
make_key(did, tname);
67 if (!s.empty()) has_positions_cache = 1;
69 set_positionlist(did, tname, s);
79 auto ptr =
term.internal->get_vec_termpos();
82 store_positions(position_table, did, tname, *ptr, modifying);
87 if (
pos !=
term.positionlist_end()) {
90 while (
pos !=
term.positionlist_end()) {
94 store_positions(position_table, did, tname, posvec, modifying);
100 delete_positionlist(did, tname);
108 has_positions_cache = s.empty() ? -1 : 1;
109 pos_changes.insert(make_pair(
term, map<Xapian::docid, string>()))
110 .first->second[did] = s;
117 set_positionlist(did,
term, {});
125 auto i = pos_changes.find(
term);
126 if (i == pos_changes.end())
128 const map<Xapian::docid, string> & m = i->second;
129 auto j = m.find(did);
139 if (has_positions_cache < 0) {
143 for (
const auto& i : pos_changes) {
144 const map<Xapian::docid, string>& m = i.second;
145 for (
const auto& j : m) {
146 const string & s = j.second;
156 return has_positions_cache;
163 doclen_changes.clear();
169 auto i = postlist_changes.find(
term);
170 if (i == postlist_changes.end())
return;
174 postlist_changes.erase(i);
180 for (
auto i = postlist_changes.begin(); i != postlist_changes.end(); ++i) {
183 postlist_changes.clear();
190 return flush_all_post_lists(table);
192 auto begin = postlist_changes.lower_bound(pfx);
196 if (pfxinc.back() !=
'\xff') {
198 end = postlist_changes.lower_bound(pfxinc);
201 pfxinc.resize(pfxinc.size() - 1);
202 if (pfxinc.empty()) {
203 end = postlist_changes.end();
208 for (
auto i = begin; i != end; ++i) {
214 postlist_changes.erase(begin, end);
220 flush_doclengths(table);
221 flush_all_post_lists(table);
227 for (
auto i : pos_changes) {
228 const string &
term = i.first;
229 const map<Xapian::docid, string> & m = i.second;
232 const string & s = j.second;
240 has_positions_cache = -1;
void set_positionlist(Xapian::docid did, std::string_view tname, std::string_view s)
Set the position list for term tname 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 tname)
Delete the position list for term tname in document did.
static std::string make_key(Xapian::docid did, std::string_view term)
void merge_changes(std::string_view term, const Inverter::PostingChanges &changes)
Merge changes for a term.
void merge_doclen_changes(const std::map< Xapian::docid, Xapian::termcount > &doclens)
Merge document length changes.
bool get_exact_entry(std::string_view key, std::string &tag) const
Read an entry from the table, if and only if it is exactly that being asked for.
glass_tablesize_t get_entry_count() const
Return a count of the number of entries in the table.
void flush_post_list(GlassPostListTable &table, std::string_view term)
Flush postlist changes for term.
void flush_all_post_lists(GlassPostListTable &table)
Flush postlist changes for all terms.
bool get_positionlist(Xapian::docid did, std::string_view term, std::string &s) const
void store_positions(const GlassPositionListTable &position_table, Xapian::docid did, std::string_view tname, const Xapian::VecCOW< Xapian::termpos > &posvec, bool modifying)
bool has_positions(const GlassPositionListTable &position_table) const
void delete_positionlist(Xapian::docid did, std::string_view term)
void set_positionlist(Xapian::docid did, std::string_view term, std::string_view s)
void flush_doclengths(GlassPostListTable &table)
Flush document length changes.
void flush_post_lists(GlassPostListTable &table, std::string_view pfx)
Flush postlist changes for all terms which start with pfx.
void flush_pos_lists(GlassPositionListTable &table)
Flush position changes.
void flush(GlassPostListTable &table)
Flush all postlist table changes.
Class for iterating over term positions.
Class for iterating over a list of terms.
Suitable for "simple" type T.
void reserve(size_type n)
unsigned long long glass_tablesize_t
How many entries there are in a table.
Inverter class which "inverts the file".
A position list in a glass database.
Postlists in glass databases.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Abstract base class for termlists.