21 #ifndef XAPIAN_INCLUDED_GLASS_INVERTER_H 22 #define XAPIAN_INCLUDED_GLASS_INVERTER_H 66 pl_changes.insert(std::make_pair(did, wdf));
81 pl_changes.insert(std::make_pair(did, new_wdf));
89 pl_changes[did] = wdf;
103 cf_delta += new_wdf - old_wdf;
104 pl_changes[did] = new_wdf;
123 mutable int has_positions_cache = -1;
126 std::map<std::string, std::map<Xapian::docid, std::string>>
pos_changes;
130 const std::string & tname,
131 const std::vector<Xapian::termpos> & posvec,
135 const std::string & term,
136 const std::string & s);
145 std::map<std::string, PostingChanges>::iterator i;
146 i = postlist_changes.find(term);
147 if (i == postlist_changes.end()) {
148 postlist_changes.insert(
151 i->second.add_posting(did, wdf);
157 std::map<std::string, PostingChanges>::iterator i;
158 i = postlist_changes.find(term);
159 if (i == postlist_changes.end()) {
160 postlist_changes.insert(
163 i->second.remove_posting(did, wdf);
170 std::map<std::string, PostingChanges>::iterator i;
171 i = postlist_changes.find(term);
172 if (i == postlist_changes.end()) {
173 postlist_changes.insert(
176 i->second.update_posting(did, old_wdf, new_wdf);
182 const std::string & tname,
184 bool modifying =
false);
187 const std::string & term);
190 const std::string & term,
191 std::string & s)
const;
196 doclen_changes.clear();
197 postlist_changes.clear();
199 has_positions_cache = -1;
206 doclen_changes[did] = doclen;
215 std::map<Xapian::docid, Xapian::termcount>::const_iterator i;
216 i = doclen_changes.find(did);
217 if (i == doclen_changes.end())
246 std::map<std::string, PostingChanges>::const_iterator i;
247 i = postlist_changes.find(term);
248 if (i == postlist_changes.end()) {
251 tf_delta = i->second.get_tfdelta();
252 cf_delta = i->second.get_cfdelta();
257 #endif // XAPIAN_INCLUDED_GLASS_INVERTER_H
The Xapian namespace contains public interfaces for the Xapian library.
PostingChanges(Xapian::docid did, Xapian::termcount wdf)
Constructor for an added posting.
Xapian::termcount_diff get_tfdelta() const
Get the term frequency delta.
Class which "inverts the file".
void delete_doclength(Xapian::docid did)
Class for storing the changes in frequencies for a term.
Convert types to std::string.
void add(const std::string &key, const std::string &tag, bool already_compressed=false)
Add a key/tag pair to the table, replacing any existing pair with the same key.
Hierarchy of classes which Xapian can throw as exceptions.
Class for iterating over a list of terms.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Xapian::termcount_diff get_cfdelta() const
Get the collection frequency delta.
bool get_doclength(Xapian::docid did, Xapian::termcount &doclen) const
PostingChanges(Xapian::docid did, Xapian::termcount old_wdf, Xapian::termcount new_wdf)
Constructor for an updated posting.
void add_posting(Xapian::docid did, const std::string &term, Xapian::doccount wdf)
string str(int value)
Convert int to std::string.
std::map< std::string, std::map< Xapian::docid, std::string > > pos_changes
Buffered changes to positional data.
std::map< Xapian::docid, Xapian::termcount > pl_changes
Changes to this term's postlist.
Xapian::termcount_diff cf_delta
Change in collection frequency.
void set_doclength(Xapian::docid did, Xapian::termcount doclen, bool add)
Indicates an attempt to access a document not present in the database.
PostingChanges(Xapian::docid did, Xapian::termcount wdf, bool)
Constructor for a removed posting.
XAPIAN_TERMCOUNT_BASE_TYPE termcount_diff
A signed difference between two counts of terms.
void update_posting(Xapian::docid did, Xapian::termcount old_wdf, Xapian::termcount new_wdf)
Update a posting.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
void add_posting(Xapian::docid did, Xapian::termcount wdf)
Add a posting.
void update_posting(Xapian::docid did, const std::string &term, Xapian::termcount old_wdf, Xapian::termcount new_wdf)
void remove_posting(Xapian::docid did, const std::string &term, Xapian::doccount wdf)
Xapian::termcount_diff tf_delta
Change in term frequency,.
const Xapian::termcount DELETED_POSTING
Magic wdf value used for a deleted posting.
void remove_posting(Xapian::docid did, Xapian::termcount wdf)
Remove a posting.
std::map< Xapian::docid, Xapian::termcount > doclen_changes
Buffered changes to document lengths.
Various assertion macros.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
std::map< std::string, PostingChanges > postlist_changes
Buffered changes to postlists.
bool get_deltas(const std::string &term, Xapian::termcount_diff &tf_delta, Xapian::termcount_diff &cf_delta) const