rclabstract: fixed log call formats and indentation
This commit is contained in:
parent
653b1fb5a5
commit
207e3d5af7
@ -50,7 +50,7 @@ static void listList(const string& what, const vector<string>&l)
|
||||
for (vector<string>::const_iterator it = l.begin(); it != l.end(); it++) {
|
||||
a = a + *it + " ";
|
||||
}
|
||||
LOGDEB("" << (what) << ": " << (a) << "\n" );
|
||||
LOGDEB("" << what << ": " << a << "\n");
|
||||
}
|
||||
#else
|
||||
#define LOGABS LOGDEB2
|
||||
@ -95,7 +95,7 @@ bool Query::Native::getMatchTerms(unsigned long xdocid, vector<string>& terms)
|
||||
xenquire->get_matching_terms_end(id)),
|
||||
m_q->m_db->m_ndb->xrdb, m_q->m_reason);
|
||||
if (!m_q->m_reason.empty()) {
|
||||
LOGERR("getMatchTerms: xapian error: " << (m_q->m_reason) << "\n" );
|
||||
LOGERR("getMatchTerms: xapian error: " << m_q->m_reason << "\n");
|
||||
return false;
|
||||
}
|
||||
noPrefixList(iterms, terms);
|
||||
@ -127,7 +127,8 @@ void Query::Native::setDbWideQTermsFreqs()
|
||||
for (vector<string>::const_iterator qit = qterms.begin();
|
||||
qit != qterms.end(); qit++) {
|
||||
termfreqs[*qit] = xrdb.get_termfreq(*qit) / doccnt;
|
||||
LOGABS("setDbWideQTermFreqs: [" << (qit) << "] db freq " << (termfreqs[*qit]) << "\n" );
|
||||
LOGABS("setDbWideQTermFreqs: [" << *qit << "] db freq " <<
|
||||
termfreqs[*qit] << "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +166,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
|
||||
{
|
||||
string deb;
|
||||
hld.toString(deb);
|
||||
LOGABS("qualityTerms: hld: " << (deb) << "\n" );
|
||||
LOGABS("qualityTerms: hld: " << deb << "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -177,7 +178,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
|
||||
if (eit != hld.terms.end()) {
|
||||
byRoot[eit->second].push_back(*qit);
|
||||
} else {
|
||||
LOGDEB0("qualityTerms: [" << ((*qit)) << "] not found in hld\n" );
|
||||
LOGDEB0("qualityTerms: [" << *qit << "] not found in hld\n");
|
||||
byRoot[*qit].push_back(*qit);
|
||||
}
|
||||
}
|
||||
@ -194,7 +195,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
|
||||
}
|
||||
byRootstr.append("\n");
|
||||
}
|
||||
LOGABS("\nqualityTerms: uterms to terms: " << (byRootstr) << "\n" );
|
||||
LOGABS("\nqualityTerms: uterms to terms: " << byRootstr << "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -245,7 +246,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
|
||||
LOGABS("qualityTerms: group\n");
|
||||
for (vector<string>::const_iterator qit = mit->second.begin();
|
||||
qit != mit->second.end(); qit++) {
|
||||
LOGABS("" << (mit->first) << "->[" << (qit) << "]\n" );
|
||||
LOGABS("" << mit->first << "->[" << *qit << "]\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -316,13 +317,14 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
int imaxoccs, int ictxwords)
|
||||
{
|
||||
Chrono chron;
|
||||
LOGABS("makeAbstract: docid " << (long(docid)) << " imaxoccs " << (imaxoccs) << " ictxwords " << (ictxwords) << "\n" );
|
||||
LOGABS("makeAbstract: docid " << docid << " imaxoccs " <<
|
||||
imaxoccs << " ictxwords " << ictxwords << "\n");
|
||||
|
||||
// The (unprefixed) terms matched by this document
|
||||
vector<string> matchedTerms;
|
||||
getMatchTerms(docid, matchedTerms);
|
||||
if (matchedTerms.empty()) {
|
||||
LOGDEB("makeAbstract::Empty term list\n" );
|
||||
LOGDEB("makeAbstract:"<<chron.millis()<<"mS:Empty term list\n");
|
||||
return ABSRES_ERROR;
|
||||
}
|
||||
|
||||
@ -339,10 +341,10 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
// aggregated by the qualityTerms() routine.
|
||||
multimap<double, vector<string> > byQ;
|
||||
double totalweight = qualityTerms(docid, matchedTerms, byQ);
|
||||
LOGABS("makeAbstract:" << (chron.ms()) << ": computed Qcoefs.\n" );
|
||||
LOGABS("makeAbstract:" << chron.millis() << "mS: computed Qcoefs.\n");
|
||||
// This can't happen, but would crash us
|
||||
if (totalweight == 0.0) {
|
||||
LOGERR("makeAbstract: totalweight == 0.0 !\n" );
|
||||
LOGERR("makeAbstract:"<<chron.millis()<<"mS: totalweight == 0.0 !\n");
|
||||
return ABSRES_ERROR;
|
||||
}
|
||||
|
||||
@ -376,7 +378,8 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
const unsigned int maxtotaloccs = imaxoccs > 0 ? imaxoccs :
|
||||
m_q->m_db->getAbsLen() /(7 * (m_q->m_db->getAbsCtxLen() + 1));
|
||||
int ctxwords = ictxwords == -1 ? m_q->m_db->getAbsCtxLen() : ictxwords;
|
||||
LOGABS("makeAbstract:" << (chron.ms()) << ": mxttloccs " << (maxtotaloccs) << " ctxwords " << (ctxwords) << "\n" );
|
||||
LOGABS("makeAbstract:" << chron.millis() << "mS: mxttloccs " <<
|
||||
maxtotaloccs << " ctxwords " << ctxwords << "\n");
|
||||
|
||||
int ret = ABSRES_OK;
|
||||
|
||||
@ -404,7 +407,8 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
|
||||
string qterm = *qit;
|
||||
|
||||
LOGABS("makeAbstract: [" << (qterm) << "] " << (maxgrpoccs) << " max grp occs (coef " << (q) << ")\n" );
|
||||
LOGABS("makeAbstract: [" << qterm << "] " << maxgrpoccs <<
|
||||
" max grp occs (coef " << q << ")\n");
|
||||
|
||||
// The match term may span several words
|
||||
int qtrmwrdcnt =
|
||||
@ -423,7 +427,9 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
int ipos = *pos;
|
||||
if (ipos < int(baseTextPosition)) // Not in text body
|
||||
continue;
|
||||
LOGABS("makeAbstract: [" << (qterm) << "] at pos " << (ipos) << " grpoccs " << (grpoccs) << " maxgrpoccs " << (maxgrpoccs) << "\n" );
|
||||
LOGABS("makeAbstract: [" << qterm << "] at pos " <<
|
||||
ipos << " grpoccs " << grpoccs << " maxgrpoccs " <<
|
||||
maxgrpoccs << "\n");
|
||||
|
||||
totaloccs++;
|
||||
grpoccs++;
|
||||
@ -486,7 +492,8 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
}
|
||||
maxpos += ctxwords + 1;
|
||||
|
||||
LOGABS("makeAbstract:" << (chron.millis()) << ":chosen number of positions " << (totaloccs) << "\n" );
|
||||
LOGABS("makeAbstract:" << chron.millis() <<
|
||||
"mS:chosen number of positions " << totaloccs << "\n");
|
||||
// This can happen if there are term occurences in the keywords
|
||||
// etc. but not elsewhere ?
|
||||
if (totaloccs == 0) {
|
||||
@ -509,7 +516,8 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
continue;
|
||||
if (m_q->m_snipMaxPosWalk > 0 && cutoff-- < 0) {
|
||||
ret |= ABSRES_TERMMISS;
|
||||
LOGDEB0("makeAbstract: max term count cutoff " << (m_q->m_snipMaxPosWalk) << "\n" );
|
||||
LOGDEB0("makeAbstract: max term count cutoff " <<
|
||||
m_q->m_snipMaxPosWalk << "\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -519,7 +527,8 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
pos != xrdb.positionlist_end(docid, *term); pos++) {
|
||||
if (m_q->m_snipMaxPosWalk > 0 && cutoff-- < 0) {
|
||||
ret |= ABSRES_TERMMISS;
|
||||
LOGDEB0("makeAbstract: max term count cutoff " << (m_q->m_snipMaxPosWalk) << "\n" );
|
||||
LOGDEB0("makeAbstract: max term count cutoff " <<
|
||||
m_q->m_snipMaxPosWalk << "\n");
|
||||
break;
|
||||
}
|
||||
// If we are beyond the max possible position, stop
|
||||
@ -533,13 +542,15 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
// at the same position, we want to keep only the
|
||||
// first one (ie: dockes and dockes@wanadoo.fr)
|
||||
if (vit->second.empty()) {
|
||||
LOGDEB2("makeAbstract: populating: [" << ((*term)) << "] at " << (*pos) << "\n" );
|
||||
LOGDEB2("makeAbstract: populating: [" << *term <<
|
||||
"] at " << *pos << "\n");
|
||||
sparseDoc[*pos] = *term;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LOGABS("makeAbstract:" << chron.millis() << "mS: all term poslist read\n");
|
||||
|
||||
#if 0
|
||||
// Debug only: output the full term[position] vector
|
||||
@ -550,11 +561,11 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
it++, ipos++) {
|
||||
if (it->empty()) {
|
||||
if (!epty)
|
||||
LOGDEB("makeAbstract:vec[" << (ipos) << "]: [" << (it) << "]\n" );
|
||||
LOGDEB("makeAbstract:vec[" << ipos << "]: [" << it << "]\n");
|
||||
epty=true;
|
||||
} else {
|
||||
epty = false;
|
||||
LOGDEB("makeAbstract:vec[" << (ipos) << "]: [" << (it) << "]\n" );
|
||||
LOGDEB("makeAbstract:vec[" << ipos << "]: [" << it << "]\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -562,7 +573,8 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
vector<int> vpbreaks;
|
||||
ndb->getPagePositions(docid, vpbreaks);
|
||||
|
||||
LOGABS("makeAbstract:" << (chron.millis()) << ": extracting. Got " << (vpbreaks.size()) << " pages\n" );
|
||||
LOGABS("makeAbstract:" << chron.millis() << "mS: extracting. Got " <<
|
||||
vpbreaks.size() << " pages\n");
|
||||
// Finally build the abstract by walking the map (in order of position)
|
||||
vabs.clear();
|
||||
string chunk;
|
||||
@ -571,7 +583,8 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
string term;
|
||||
for (map<unsigned int, string>::const_iterator it = sparseDoc.begin();
|
||||
it != sparseDoc.end(); it++) {
|
||||
LOGDEB2("Abtract:output " << (it->first) << " -> [" << (it->second) << "]\n" );
|
||||
LOGDEB2("Abtract:output " << it->first << " -> [" << it->second <<
|
||||
"]\n");
|
||||
if (!occupiedmarker.compare(it->second)) {
|
||||
LOGDEB("Abstract: qtrm position not filled ??\n");
|
||||
continue;
|
||||
@ -603,12 +616,9 @@ int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
if (!chunk.empty())
|
||||
vabs.push_back(Snippet(page, chunk).setTerm(term));
|
||||
|
||||
LOGDEB2("makeAbtract: done in " << (chron.millis()) << " mS\n" );
|
||||
LOGABS("makeAbtract: done in " << chron.millis() << " mS\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user