add terms for doc md5s

This commit is contained in:
Jean-Francois Dockes 2013-04-16 15:56:49 +02:00
parent 9db6529a6f
commit c7d9d524f9
2 changed files with 8 additions and 5 deletions

View file

@ -1129,13 +1129,15 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
RECORD_APPEND(record, string(cstr_mbreaks), multibreaks.str()); RECORD_APPEND(record, string(cstr_mbreaks), multibreaks.str());
} }
// If the file's md5 was computed, add value. This is optionally // If the file's md5 was computed, add value and term.
// used for query result duplicate elimination. // The value is optionally used for query result duplicate elimination,
string& md5 = doc.meta[Doc::keymd5]; // and the term to find the duplicates.
if (!md5.empty()) { const string *md5;
if (doc.peekmeta(Doc::keymd5, &md5) && !md5->empty()) {
string digest; string digest;
MD5HexScan(md5, digest); MD5HexScan(*md5, digest);
newdocument.add_value(VALUE_MD5, digest); newdocument.add_value(VALUE_MD5, digest);
newdocument.add_boolean_term(wrap_prefix("XM") + *md5);
} }
LOGDEB0(("Rcl::Db::add: new doc record:\n%s\n", record.c_str())); LOGDEB0(("Rcl::Db::add: new doc record:\n%s\n", record.c_str()));

View file

@ -40,6 +40,7 @@ xapyearmon = M
title = S ; wdfinc = 10 title = S ; wdfinc = 10
mtype = T mtype = T
ext = XE ext = XE
rclmd5 = XM
dir = XP dir = XP
abstract = XS abstract = XS
filename = XSFN filename = XSFN