moved code around

This commit is contained in:
Jean-Francois Dockes 2013-04-22 17:30:11 +02:00
parent 906e58feff
commit fc4adfdbaa
2 changed files with 15 additions and 7 deletions

View File

@ -107,6 +107,20 @@ class Db::Native {
int getPageNumberForPosition(const vector<int>& pbreaks, unsigned int pos);
bool dbDataToRclDoc(Xapian::docid docid, std::string &data, Doc &doc);
bool xdocToUdi(Xapian::Document& xdoc, string &udi)
{
Xapian::TermIterator xit = xdoc.termlist_begin();
xit.skip_to(wrap_prefix(udi_prefix));
if (xit != xdoc.termlist_end()) {
udi = *xit;
if (!udi.empty()) {
udi = udi.substr(wrap_prefix(udi_prefix).size());
return true;
}
}
return false;
}
/** Compute list of subdocuments for a given udi. We look for documents
* indexed by a parent term matching the udi, the posting list for the

View File

@ -421,13 +421,7 @@ bool Query::getDoc(int xapi, Doc &doc)
data = xdoc.get_data();
m_reason.erase();
Chrono chron;
Xapian::TermIterator it = xdoc.termlist_begin();
it.skip_to(wrap_prefix(udi_prefix));
if (it != xdoc.termlist_end()) {
udi = *it;
if (!udi.empty())
udi = udi.substr(wrap_prefix(udi_prefix).size());
}
m_db->m_ndb->xdocToUdi(xdoc, udi);
LOGDEB2(("Query::getDoc: %d ms for udi [%s], collapse count %d\n",
chron.millis(), udi.c_str(), collapsecount));
break;