Displaying 2 results from an estimated 2 matches for "cyrusid".
2013 Jun 19
2
Compact databases and removing stale records at the same time
...dest, Xapian::DB_CREATE);
/* copy all matching documents to the new DB */
Xapian::PostingIterator it;
for (it = srcdb.postlist_begin(""); it != srcdb.postlist_end(""); it++) {
Xapian::docid did = *it;
Xapian::Document doc = srcdb.get_document(did);
std::string cyrusid = doc.get_value(SLOT_CYRUSID);
if (cb(cyrusid.c_str(), rock)) {
destdb.add_document(doc);
}
}
/* commit all changes explicitly */
destdb.commit();
}
FYI: SLOT_CYRUSID is just 0.
Thanks heaps for your help on this. Honestly, it's not a deal-breaker for us to use this much...
2013 Jun 19
2
Compact databases and removing stale records at the same time
...: Xapian: caught exception: %s: %s",
err.get_context().c_str(), err.get_description().c_str());
r = IMAP_IOERROR;
}
return r;
}
/* cb returns true if document should be copied, false if not */
int xapian_filter(const char *dest, const char **sources,
int (*cb)(const char *cyrusid, void *rock),
void *rock)
{
int r = 0;
int count = 0;
try {
/* set up a cursor to read from all the source databases */
Xapian::Database *srcdb = new Xapian::Database();
while (*sources) {
srcdb->add_database(Xapian::Database(*sources++));
}
Xapian::Enquire enquire(*sr...