Add parameter to truncate all document text to specified length

This commit is contained in:
Jean-Francois Dockes 2018-04-08 10:54:09 +02:00
parent cedff8ce7c
commit 21adaca229
2 changed files with 7 additions and 0 deletions

View File

@ -876,6 +876,7 @@ Db::Db(const RclConfig *cfp)
m_config->getConfParam("maxfsoccuppc", &m_maxFsOccupPc);
m_config->getConfParam("idxflushmb", &m_flushMb);
m_config->getConfParam("idxmetastoredlen", &m_idxMetaStoredLen);
m_config->getConfParam("idxtexttruncatelen", &m_idxTextTruncateLen);
}
}
@ -1480,6 +1481,10 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
}
} else {
if (m_idxTextTruncateLen > 0) {
doc.text = truncate_to_word(doc.text, m_idxTextTruncateLen);
}
// If the ipath is like a path, index the last element. This is
// for compound documents like zip and chm for which the filter
// uses the file path as ipath.

View File

@ -509,6 +509,8 @@ private:
// text when indexing. It only has an influence on the size of the
// db as we are free to shorten it again when displaying
int m_idxAbsTruncLen;
// Document text truncation length
int m_idxTextTruncateLen{0};
// This is the size of the abstract that we synthetize out of query
// term contexts at *query time*
int m_synthAbsLen;