idx: make Doc parameter to addOrUpdate non const to avoid extra copy

This commit is contained in:
Jean-Francois Dockes 2012-03-07 08:34:25 +01:00
parent 05502e8fc7
commit 7b5a891ee3
3 changed files with 5 additions and 6 deletions

View File

@ -1064,7 +1064,7 @@ void *DbUpdWorker(void* vdbp)
// date, mime type etc. , create the document data record (more // date, mime type etc. , create the document data record (more
// metadata), and update database // metadata), and update database
bool Db::addOrUpdate(const string &udi, const string &parent_udi, bool Db::addOrUpdate(const string &udi, const string &parent_udi,
const Doc &idoc) Doc &doc)
{ {
LOGDEB(("Db::add: udi [%s] parent [%s]\n", LOGDEB(("Db::add: udi [%s] parent [%s]\n",
udi.c_str(), parent_udi.c_str())); udi.c_str(), parent_udi.c_str()));
@ -1084,8 +1084,6 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi,
m_occtxtsz = m_curtxtsz; m_occtxtsz = m_curtxtsz;
} }
Doc doc = idoc;
Xapian::Document newdocument; Xapian::Document newdocument;
// The term processing pipeline: // The term processing pipeline:

View File

@ -153,7 +153,7 @@ class Db {
* possible depending on the document type. parent_udi is only * possible depending on the document type. parent_udi is only
* use for subdocs, else set it to empty */ * use for subdocs, else set it to empty */
bool addOrUpdate(const string &udi, const string &parent_udi, bool addOrUpdate(const string &udi, const string &parent_udi,
const Doc &doc); Doc &doc);
/** Delete document(s) for given UDI, including subdocs */ /** Delete document(s) for given UDI, including subdocs */
bool purgeFile(const string &udi, bool *existed = 0); bool purgeFile(const string &udi, bool *existed = 0);

View File

@ -54,18 +54,19 @@ class Doc {
string utf8fn; string utf8fn;
// Internal path for multi-doc files. Ascii // Internal path for multi-doc files. Ascii
// Set by DbIndexer::processone // Set by FsIndexer::processone
string ipath; string ipath;
// Mime type. Set by FileInterner::internfile // Mime type. Set by FileInterner::internfile
string mimetype; string mimetype;
// File modification time as decimal ascii unix time // File modification time as decimal ascii unix time
// Set by DbIndexer::processone // Set by FsIndexer::processone
string fmtime; string fmtime;
// Data reference date (same format). Ie: mail date // Data reference date (same format). Ie: mail date
// Possibly set by mimetype-specific handler // Possibly set by mimetype-specific handler
// Filter::metaData["modificationdate"]
string dmtime; string dmtime;
// Charset we transcoded the 'text' field from (in case we want back) // Charset we transcoded the 'text' field from (in case we want back)