rclquery: fixed log call formats and indentation
This commit is contained in:
parent
ab5a628b9b
commit
653b1fb5a5
@ -132,7 +132,7 @@ public:
|
|||||||
sortterm = sortterm.substr(i1, sortterm.size()-i1);
|
sortterm = sortterm.substr(i1, sortterm.size()-i1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGDEB2("QSorter: [" << (term) << "] -> [" << (sortterm) << "]\n" );
|
LOGDEB2("QSorter: [" << term << "] -> [" << sortterm << "]\n");
|
||||||
return sortterm;
|
return sortterm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,8 @@ void Query::setSortBy(const string& fld, bool ascending) {
|
|||||||
m_sortField = m_db->getConf()->fieldQCanon(fld);
|
m_sortField = m_db->getConf()->fieldQCanon(fld);
|
||||||
m_sortAscending = ascending;
|
m_sortAscending = ascending;
|
||||||
}
|
}
|
||||||
LOGDEB0("RclQuery::setSortBy: [" << (m_sortField) << "] " << (m_sortAscending ? "ascending" : "descending") << "\n" );
|
LOGDEB0("RclQuery::setSortBy: [" << m_sortField << "] " <<
|
||||||
|
(m_sortAscending ? "ascending" : "descending") << "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define ISNULL(X) (X).isNull()
|
//#define ISNULL(X) (X).isNull()
|
||||||
@ -232,7 +233,7 @@ bool Query::setQuery(std::shared_ptr<SearchData> sdata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_reason.empty()) {
|
if (!m_reason.empty()) {
|
||||||
LOGDEB("Query::SetQuery: xapian error " << (m_reason) << "\n" );
|
LOGDEB("Query::SetQuery: xapian error " << m_reason << "\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +242,7 @@ bool Query::setQuery(std::shared_ptr<SearchData> sdata)
|
|||||||
|
|
||||||
sdata->setDescription(d);
|
sdata->setDescription(d);
|
||||||
m_sd = sdata;
|
m_sd = sdata;
|
||||||
LOGDEB("Query::SetQuery: Q: " << (sdata->getDescription()) << "\n" );
|
LOGDEB("Query::SetQuery: Q: " << sdata->getDescription() << "\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,17 +261,17 @@ bool Query::getQueryTerms(vector<string>& terms)
|
|||||||
}
|
}
|
||||||
} XCATCHERROR(ermsg);
|
} XCATCHERROR(ermsg);
|
||||||
if (!ermsg.empty()) {
|
if (!ermsg.empty()) {
|
||||||
LOGERR("getQueryTerms: xapian error: " << (ermsg) << "\n" );
|
LOGERR("getQueryTerms: xapian error: " << ermsg << "\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Query::makeDocAbstract(const Doc &doc,
|
int Query::makeDocAbstract(const Doc &doc, vector<Snippet>& abstract,
|
||||||
vector<Snippet>& abstract,
|
|
||||||
int maxoccs, int ctxwords)
|
int maxoccs, int ctxwords)
|
||||||
{
|
{
|
||||||
LOGDEB("makeDocAbstract: maxoccs " << (maxoccs) << " ctxwords " << (ctxwords) << "\n" );
|
LOGDEB("makeDocAbstract: maxoccs " << maxoccs << " ctxwords " <<
|
||||||
|
ctxwords << "\n");
|
||||||
if (!m_db || !m_db->m_ndb || !m_db->m_ndb->m_isopen || !m_nq) {
|
if (!m_db || !m_db->m_ndb || !m_db->m_ndb->m_isopen || !m_nq) {
|
||||||
LOGERR("Query::makeDocAbstract: no db or no nq\n");
|
LOGERR("Query::makeDocAbstract: no db or no nq\n");
|
||||||
return ABSRES_ERROR;
|
return ABSRES_ERROR;
|
||||||
@ -279,7 +280,7 @@ int Query::makeDocAbstract(const Doc &doc,
|
|||||||
XAPTRY(ret = m_nq->makeAbstract(doc.xdocid, abstract, maxoccs, ctxwords),
|
XAPTRY(ret = m_nq->makeAbstract(doc.xdocid, abstract, maxoccs, ctxwords),
|
||||||
m_db->m_ndb->xrdb, m_reason);
|
m_db->m_ndb->xrdb, m_reason);
|
||||||
if (!m_reason.empty()) {
|
if (!m_reason.empty()) {
|
||||||
LOGDEB("makeDocAbstract: makeAbstract error, reason: " << (m_reason) << "\n" );
|
LOGDEB("makeDocAbstract: makeAbstract: reason: " << m_reason << "\n");
|
||||||
return ABSRES_ERROR;
|
return ABSRES_ERROR;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -354,9 +355,9 @@ int Query::getResCnt()
|
|||||||
m_resCnt = m_nq->xmset.get_matches_lower_bound(),
|
m_resCnt = m_nq->xmset.get_matches_lower_bound(),
|
||||||
m_db->m_ndb->xrdb, m_reason);
|
m_db->m_ndb->xrdb, m_reason);
|
||||||
|
|
||||||
LOGDEB("Query::getResCnt: " << (m_resCnt) << " " << (chron.millis()) << " mS\n" );
|
LOGDEB("Query::getResCnt: "<<m_resCnt<<" "<< chron.millis() << " mS\n");
|
||||||
if (!m_reason.empty())
|
if (!m_reason.empty())
|
||||||
LOGERR("xenquire->get_mset: exception: " << (m_reason) << "\n" );
|
LOGERR("xenquire->get_mset: exception: " << m_reason << "\n");
|
||||||
} else {
|
} else {
|
||||||
m_resCnt = m_nq->xmset.get_matches_lower_bound();
|
m_resCnt = m_nq->xmset.get_matches_lower_bound();
|
||||||
}
|
}
|
||||||
@ -373,7 +374,7 @@ int Query::getResCnt()
|
|||||||
// on subsequent calls is probably only due to disk caching.
|
// on subsequent calls is probably only due to disk caching.
|
||||||
bool Query::getDoc(int xapi, Doc &doc)
|
bool Query::getDoc(int xapi, Doc &doc)
|
||||||
{
|
{
|
||||||
LOGDEB1("Query::getDoc: xapian enquire index " << (xapi) << "\n" );
|
LOGDEB1("Query::getDoc: xapian enquire index " << xapi << "\n");
|
||||||
if (ISNULL(m_nq) || !m_nq->xenquire) {
|
if (ISNULL(m_nq) || !m_nq->xenquire) {
|
||||||
LOGERR("Query::getDoc: no query opened\n");
|
LOGERR("Query::getDoc: no query opened\n");
|
||||||
return false;
|
return false;
|
||||||
@ -383,14 +384,14 @@ bool Query::getDoc(int xapi, Doc &doc)
|
|||||||
int last = first + m_nq->xmset.size() -1;
|
int last = first + m_nq->xmset.size() -1;
|
||||||
|
|
||||||
if (!(xapi >= first && xapi <= last)) {
|
if (!(xapi >= first && xapi <= last)) {
|
||||||
LOGDEB("Fetching for first " << (xapi) << ", count " << (qquantum) << "\n" );
|
LOGDEB("Fetching for first " << xapi << ", count " << qquantum << "\n");
|
||||||
|
|
||||||
XAPTRY(m_nq->xmset = m_nq->xenquire->get_mset(xapi, qquantum,
|
XAPTRY(m_nq->xmset = m_nq->xenquire->get_mset(xapi, qquantum,
|
||||||
(const Xapian::RSet *)0),
|
(const Xapian::RSet *)0),
|
||||||
m_db->m_ndb->xrdb, m_reason);
|
m_db->m_ndb->xrdb, m_reason);
|
||||||
|
|
||||||
if (!m_reason.empty()) {
|
if (!m_reason.empty()) {
|
||||||
LOGERR("enquire->get_mset: exception: " << (m_reason) << "\n" );
|
LOGERR("enquire->get_mset: exception: " << m_reason << "\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_nq->xmset.empty()) {
|
if (m_nq->xmset.empty()) {
|
||||||
@ -418,7 +419,8 @@ bool Query::getDoc(int xapi, Doc &doc)
|
|||||||
m_reason.erase();
|
m_reason.erase();
|
||||||
Chrono chron;
|
Chrono chron;
|
||||||
m_db->m_ndb->xdocToUdi(xdoc, udi);
|
m_db->m_ndb->xdocToUdi(xdoc, udi);
|
||||||
LOGDEB2("Query::getDoc: " << (chron.millis()) << " ms for udi [" << (udi) << "], collapse count " << (collapsecount) << "\n" );
|
LOGDEB2("Query::getDoc: " << chron.millis() << " ms for udi [" <<
|
||||||
|
udi << "], collapse count " << collapsecount << "\n");
|
||||||
break;
|
break;
|
||||||
} catch (Xapian::DatabaseModifiedError &error) {
|
} catch (Xapian::DatabaseModifiedError &error) {
|
||||||
// retry or end of loop
|
// retry or end of loop
|
||||||
@ -429,7 +431,7 @@ bool Query::getDoc(int xapi, Doc &doc)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!m_reason.empty()) {
|
if (!m_reason.empty()) {
|
||||||
LOGERR("Query::getDoc: " << (m_reason) << "\n" );
|
LOGERR("Query::getDoc: " << m_reason << "\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
doc.meta[Rcl::Doc::keyudi] = udi;
|
doc.meta[Rcl::Doc::keyudi] = udi;
|
||||||
@ -471,7 +473,7 @@ vector<string> Query::expand(const Doc &doc)
|
|||||||
// We filter out the special terms
|
// We filter out the special terms
|
||||||
for (Xapian::ESetIterator it = eset.begin();
|
for (Xapian::ESetIterator it = eset.begin();
|
||||||
it != eset.end(); it++) {
|
it != eset.end(); it++) {
|
||||||
LOGDEB(" [" << ((*it)) << "]\n" );
|
LOGDEB(" [" << (*it) << "]\n");
|
||||||
if ((*it).empty() || has_prefix(*it))
|
if ((*it).empty() || has_prefix(*it))
|
||||||
continue;
|
continue;
|
||||||
res.push_back(*it);
|
res.push_back(*it);
|
||||||
@ -489,7 +491,7 @@ vector<string> Query::expand(const Doc &doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_reason.empty()) {
|
if (!m_reason.empty()) {
|
||||||
LOGERR("Query::expand: xapian error " << (m_reason) << "\n" );
|
LOGERR("Query::expand: xapian error " << m_reason << "\n");
|
||||||
res.clear();
|
res.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user