allow disabling storing an abstract made of the beginning of document by setting its length parameter to 0

This commit is contained in:
Jean-Francois Dockes 2017-02-27 18:26:34 +01:00
parent c8cc64366d
commit 2cfb4f7e4c

View File

@ -1216,7 +1216,7 @@ string Db::getSpellingSuggestion(const string& word)
void Db::setAbstractParams(int idxtrunc, int syntlen, int syntctxlen) void Db::setAbstractParams(int idxtrunc, int syntlen, int syntctxlen)
{ {
LOGDEB1("Db::setAbstractParams: trunc " << (idxtrunc) << " syntlen " << (syntlen) << " ctxlen " << (syntctxlen) << "\n" ); LOGDEB1("Db::setAbstractParams: trunc " << (idxtrunc) << " syntlen " << (syntlen) << " ctxlen " << (syntctxlen) << "\n" );
if (idxtrunc > 0) if (idxtrunc >= 0)
m_idxAbsTruncLen = idxtrunc; m_idxAbsTruncLen = idxtrunc;
if (syntlen > 0) if (syntlen > 0)
m_synthAbsLen = syntlen; m_synthAbsLen = syntlen;
@ -1494,6 +1494,7 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
// original file. // original file.
// Note that the map accesses by operator[] create empty entries if they // Note that the map accesses by operator[] create empty entries if they
// don't exist yet. // don't exist yet.
if (m_idxAbsTruncLen > 0) {
string& absref = doc.meta[Doc::keyabs]; string& absref = doc.meta[Doc::keyabs];
trimstring(absref, " \t\r\n"); trimstring(absref, " \t\r\n");
if (absref.empty()) { if (absref.empty()) {
@ -1511,6 +1512,7 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
RECORD_APPEND(record, Doc::keyabs, absref); RECORD_APPEND(record, Doc::keyabs, absref);
absref.clear(); absref.clear();
} }
}
// Append all regular "stored" meta fields // Append all regular "stored" meta fields
const set<string>& stored = m_config->getStoredFields(); const set<string>& stored = m_config->getStoredFields();