Take advantage of text storage when possible to display preview data for an unaccessible document

This commit is contained in:
Jean-Francois Dockes
2019-06-16 11:49:18 +02:00
parent a647d1c344
commit be214c4a5a
6 changed files with 254 additions and 189 deletions
+18
View File
@@ -992,6 +992,24 @@ bool Db::open(OpenMode mode, OpenError *error)
return false;
}
bool Db::storesDocText()
{
if (!m_ndb || !m_ndb->m_isopen) {
LOGERR("Db::storesDocText: called on non-opened db\n");
return false;
}
return m_ndb->m_storetext;
}
bool Db::getDocRawText(Doc& doc)
{
if (!m_ndb || !m_ndb->m_isopen) {
LOGERR("Db::getDocRawText: called on non-opened db\n");
return false;
}
return m_ndb->getRawText(doc.xdocid, doc.text);
}
// Note: xapian has no close call, we delete and recreate the db
bool Db::close()
{
+9
View File
@@ -189,6 +189,9 @@ public:
/** Return existing stemming databases */
vector<string> getStemLangs();
/** Check if index stores the documents' texts. Only valid after open */
bool storesDocText();
/** Test word for spelling correction candidate: not too long, no
* special chars...
* @param with_aspell test for use with aspell, else for xapian speller
@@ -341,6 +344,12 @@ public:
decide if we can update the index for it */
bool fromMainIndex(const Doc& doc);
/** Retrieve the stored doc text. This returns false if the index does not
store raw text or other problems (discriminate with storesDocText().
On success, the data is stored in doc.text
*/
bool getDocRawText(Doc& doc);
/** Retrieve an index designator for the document result. This is used
* by the GUI document history feature for remembering where a
* doc comes from and allowing later retrieval (if the ext index