Fix problems which occurred when using functions like open-parents with multiple indexes containing identical paths (udis)

This commit is contained in:
Jean-Francois Dockes
2013-05-25 11:26:57 +02:00
parent 11e0ccaa4e
commit a1b7018cfd
10 changed files with 99 additions and 59 deletions
+8 -6
View File
@@ -38,14 +38,16 @@ int DocSequence::getSeqSlice(int offs, int cnt, vector<ResListEntry>& result)
bool DocSequence::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
{
// Note: no need for setQuery here, we're just passing through a
// query-independant request
Rcl::Db *db = getDb();
if (db == 0) {
LOGERR(("DocSequence::getEnclosing: no db\n"));
return false;
}
string udi;
if (!FileInterner::getEnclosing(doc.url, doc.ipath, pdoc.url, pdoc.ipath,
udi))
if (!FileInterner::getEnclosingUDI(doc, udi))
return false;
bool dbret = getDb()->getDoc(udi, pdoc);
bool dbret = db->getDoc(udi, doc, pdoc);
return dbret && pdoc.pc != -1;
}
+4 -1
View File
@@ -136,7 +136,10 @@ bool DocSequenceHistory::getDoc(int num, Rcl::Doc &doc, string *sh)
} else
sh->erase();
}
bool ret = m_db->getDoc(m_it->udi, doc);
// For now history does not store an index id. Use empty doc as ref.
Rcl::Doc idxdoc;
bool ret = m_db->getDoc(m_it->udi, idxdoc, doc);
if (!ret || doc.pc == -1) {
doc.url = "UNKNOWN";
doc.ipath = "";