query: add duplication indicator to relevancy rating
This commit is contained in:
parent
34511918d9
commit
93fb51d59b
@ -727,7 +727,7 @@ Query_fetchone(recoll_QueryObject* self, PyObject *, PyObject *)
|
||||
|
||||
// Move some data from the dedicated fields to the meta array to make
|
||||
// fetching attributes easier. Is this actually needed ? Useful for
|
||||
// url and relevancy rating which are also formatted .
|
||||
// url which is also formatted .
|
||||
Rcl::Doc *doc = result->doc;
|
||||
printableUrl(rclconfig->getDefCharset(), doc->url,
|
||||
doc->meta[Rcl::Doc::keyurl]);
|
||||
@ -735,10 +735,6 @@ Query_fetchone(recoll_QueryObject* self, PyObject *, PyObject *)
|
||||
doc->meta[Rcl::Doc::keyipt] = doc->ipath;
|
||||
doc->meta[Rcl::Doc::keyfs] = doc->fbytes;
|
||||
doc->meta[Rcl::Doc::keyds] = doc->dbytes;
|
||||
char pc[20];
|
||||
sprintf(pc, "%02d %%", doc->pc);
|
||||
doc->meta[Rcl::Doc::keyrr] = pc;
|
||||
|
||||
return (PyObject *)result;
|
||||
}
|
||||
|
||||
|
||||
@ -90,9 +90,6 @@ void ResListPager::displayDoc(int i, Rcl::Doc& doc, const HiliteData& hdata,
|
||||
} else {
|
||||
percent = doc.pc;
|
||||
}
|
||||
// Percentage of 'relevance'
|
||||
char perbuf[20];
|
||||
sprintf(perbuf, "%3d%% ", percent);
|
||||
|
||||
// Determine icon to display if any
|
||||
string iconpath = iconPath(doc.mimetype);
|
||||
@ -186,7 +183,7 @@ void ResListPager::displayDoc(int i, Rcl::Doc& doc, const HiliteData& hdata,
|
||||
subs["L"] = linksbuf.rdbuf()->str();
|
||||
subs["N"] = numbuf;
|
||||
subs["M"] = doc.mimetype;
|
||||
subs["R"] = perbuf;
|
||||
subs["R"] = doc.meta[Rcl::Doc::keyrr];
|
||||
subs["S"] = sizebuf;
|
||||
subs["T"] = escapeHtml(doc.meta[Rcl::Doc::keytt]);
|
||||
subs["U"] = url;
|
||||
|
||||
@ -140,7 +140,7 @@ static const string keycap("caption");
|
||||
|
||||
// Turn data record from db into document fields
|
||||
bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data,
|
||||
Doc &doc, int percent)
|
||||
Doc &doc)
|
||||
{
|
||||
LOGDEB2(("Db::dbDataToRclDoc: data:\n%s\n", data.c_str()));
|
||||
ConfSimple parms(data);
|
||||
@ -161,10 +161,6 @@ bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data,
|
||||
doc.meta[Doc::keyabs] = doc.meta[Doc::keyabs].substr(rclSyntAbs.length());
|
||||
doc.syntabs = true;
|
||||
}
|
||||
char buf[20];
|
||||
sprintf(buf,"%.2f", float(percent) / 100.0);
|
||||
doc.pc = percent;
|
||||
doc.meta[Doc::keyrr] = buf;
|
||||
parms.get(Doc::keyipt, doc.ipath);
|
||||
parms.get(Doc::keyfs, doc.fbytes);
|
||||
parms.get(Doc::keyds, doc.dbytes);
|
||||
@ -1721,6 +1717,7 @@ bool Db::getDoc(const string &udi, Doc &doc)
|
||||
|
||||
// Initialize what we can in any case. If this is history, caller
|
||||
// will make partial display in case of error
|
||||
doc.meta[Rcl::Doc::keyrr] = "100%";
|
||||
doc.pc = 100;
|
||||
|
||||
string uniterm = make_uniterm(udi);
|
||||
@ -1741,7 +1738,7 @@ bool Db::getDoc(const string &udi, Doc &doc)
|
||||
Xapian::Document xdoc = m_ndb->xrdb.get_document(*docid);
|
||||
string data = xdoc.get_data();
|
||||
doc.meta[Rcl::Doc::keyudi] = udi;
|
||||
return m_ndb->dbDataToRclDoc(*docid, data, doc, 100);
|
||||
return m_ndb->dbDataToRclDoc(*docid, data, doc);
|
||||
} catch (const Xapian::DatabaseModifiedError &e) {
|
||||
m_reason = e.get_msg();
|
||||
m_ndb->xrdb.reopen();
|
||||
|
||||
@ -77,8 +77,7 @@ class Db::Native {
|
||||
|
||||
string makeAbstract(Xapian::docid id, Query *query);
|
||||
|
||||
bool dbDataToRclDoc(Xapian::docid docid, std::string &data, Doc &doc,
|
||||
int percent);
|
||||
bool dbDataToRclDoc(Xapian::docid docid, std::string &data, Doc &doc);
|
||||
|
||||
/** 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
|
||||
|
||||
@ -357,12 +357,23 @@ bool Query::getDoc(int xapi, Doc &doc)
|
||||
return false;
|
||||
}
|
||||
doc.meta[Rcl::Doc::keyudi] = udi;
|
||||
char scc[30];
|
||||
sprintf(scc, "%d", collapsecount);
|
||||
doc.meta[Rcl::Doc::keycc] = scc;
|
||||
|
||||
doc.pc = pc;
|
||||
char buf[200];
|
||||
if (collapsecount>0) {
|
||||
LOGDEB(("COLLAPSECOUNET %d\n", collapsecount));
|
||||
sprintf(buf,"%3d%% (%d)", pc, collapsecount+1);
|
||||
} else {
|
||||
sprintf(buf,"%3d%%", pc);
|
||||
}
|
||||
doc.meta[Doc::keyrr] = buf;
|
||||
|
||||
sprintf(buf, "%d", collapsecount);
|
||||
doc.meta[Rcl::Doc::keycc] = buf;
|
||||
|
||||
|
||||
// Parse xapian document's data and populate doc fields
|
||||
return m_db->m_ndb->dbDataToRclDoc(docid, data, doc, pc);
|
||||
return m_db->m_ndb->dbDataToRclDoc(docid, data, doc);
|
||||
}
|
||||
|
||||
list<string> Query::expand(const Doc &doc)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user