qresultstore: need to initialize all entries, even empty, for all records. Else default 0 points to the url!

This commit is contained in:
Jean-Francois Dockes 2020-12-19 10:37:31 +01:00
parent 22f62216d2
commit 66ecb9ec6b

View File

@ -171,6 +171,12 @@ bool QResultStore::storeQuery(Rcl::Query& query, std::set<std::string> fldspec,
STRINGCPCOPY(cp, entry.second);
}
}
// Point all empty entries to the final null byte
for (unsigned int i = 1; i < vdoc.offsets.size(); i++) {
if (vdoc.offsets[i] == 0) {
vdoc.offsets[i] = cp - 1 - vdoc.base;
}
}
}
return true;
}
@ -190,7 +196,6 @@ const char *QResultStore::fieldValue(int docindex, const std::string& fldname)
auto it = m->keyidx.find(fldname);
if (it == m->keyidx.end() ||
it->second < 0 || it->second >= int(vdoc.offsets.size())) {
//??
return nullptr;
}
return vdoc.base + vdoc.offsets[it->second];