comments and justification
This commit is contained in:
@@ -254,7 +254,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
|
||||
}
|
||||
|
||||
|
||||
// Return page number for first match of "significant" term.
|
||||
// Choose most interesting term and return the page number for its first match
|
||||
int Query::Native::getFirstMatchPage(Xapian::docid docid, string& term)
|
||||
{
|
||||
LOGDEB("Query::Native::getFirstMatchPage\n");
|
||||
@@ -286,9 +286,7 @@ int Query::Native::getFirstMatchPage(Xapian::docid docid, string& term)
|
||||
qualityTerms(docid, terms, byQ);
|
||||
|
||||
for (auto mit = byQ.rbegin(); mit != byQ.rend(); mit++) {
|
||||
for (vector<string>::const_iterator qit = mit->second.begin();
|
||||
qit != mit->second.end(); qit++) {
|
||||
string qterm = *qit;
|
||||
for (const auto& qterm : mit->second) {
|
||||
Xapian::PositionIterator pos;
|
||||
string emptys;
|
||||
try {
|
||||
@@ -619,9 +617,8 @@ int Query::Native::abstractFromIndex(
|
||||
// possibly retried by our caller.
|
||||
//
|
||||
// @param[out] vabs the abstract is returned as a vector of snippets.
|
||||
int Query::Native::makeAbstract(Xapian::docid docid,
|
||||
vector<Snippet>& vabs,
|
||||
int imaxoccs, int ictxwords, bool sortbypage)
|
||||
int Query::Native::makeAbstract(
|
||||
Xapian::docid docid, vector<Snippet>& vabs, int imaxoccs, int ictxwords, bool sortbypage)
|
||||
{
|
||||
chron.restart();
|
||||
LOGDEB("makeAbstract: docid " << docid << " imaxoccs " <<
|
||||
|
||||
+8
-7
@@ -96,10 +96,13 @@ const string pathelt_prefix = "XP";
|
||||
static const string udi_prefix("Q");
|
||||
static const string parent_prefix("F");
|
||||
|
||||
// Special terms to mark begin/end of field (for anchored searches), and
|
||||
// page breaks
|
||||
// Special terms to mark begin/end of field (for anchored searches).
|
||||
string start_of_field_term;
|
||||
string end_of_field_term;
|
||||
|
||||
// Special term for page breaks. Note that we use a complicated mechanism for multiple page
|
||||
// breaks at the same position, when it would have been probably simpler to use XXPG/n terms
|
||||
// instead (did not try to implement though). A change would force users to reindex.
|
||||
const string page_break_term = "XXPG/";
|
||||
|
||||
// Special term to mark documents with children.
|
||||
@@ -1846,16 +1849,14 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
|
||||
}
|
||||
}
|
||||
|
||||
// If empty pages (multiple break at same pos) were recorded, save
|
||||
// them (this is because we have no way to record them in the
|
||||
// Xapian list
|
||||
// If empty pages (multiple break at same pos) were recorded, save them (this is
|
||||
// because we have no way to record them in the Xapian list)
|
||||
if (!tpidx.m_pageincrvec.empty()) {
|
||||
ostringstream multibreaks;
|
||||
for (unsigned int i = 0; i < tpidx.m_pageincrvec.size(); i++) {
|
||||
if (i != 0)
|
||||
multibreaks << ",";
|
||||
multibreaks << tpidx.m_pageincrvec[i].first << "," <<
|
||||
tpidx.m_pageincrvec[i].second;
|
||||
multibreaks << tpidx.m_pageincrvec[i].first << "," << tpidx.m_pageincrvec[i].second;
|
||||
}
|
||||
RECORD_APPEND(record, string(cstr_mbreaks), multibreaks.str());
|
||||
}
|
||||
|
||||
@@ -360,7 +360,6 @@ int Query::getFirstMatchPage(const Doc &doc, string& term)
|
||||
return m_reason.empty() ? pagenum : -1;
|
||||
}
|
||||
|
||||
|
||||
// Mset size
|
||||
// Note: times for retrieving (multiple times)all docs from a sample
|
||||
// 25k docs db (q: mime:*)
|
||||
@@ -511,8 +510,7 @@ vector<string> Query::expand(const Doc &doc)
|
||||
Xapian::ESet eset = m_nq->xenquire->get_eset(20, rset, false);
|
||||
LOGDEB("ESet terms:\n");
|
||||
// We filter out the special terms
|
||||
for (Xapian::ESetIterator it = eset.begin();
|
||||
it != eset.end(); it++) {
|
||||
for (Xapian::ESetIterator it = eset.begin(); it != eset.end(); it++) {
|
||||
LOGDEB(" [" << (*it) << "]\n");
|
||||
if ((*it).empty() || has_prefix(*it))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user