arrange to enable passing a match term as an argument when opening a document with the native editor (only / mostly pdf for now)

This commit is contained in:
Jean-Francois Dockes 2012-10-02 14:40:09 +02:00
parent 0b65142149
commit bf6bbfbf14
13 changed files with 115 additions and 56 deletions

View file

@ -4563,6 +4563,14 @@ x-my-tag = mailmytag
snippet.</para></formalpara> snippet.</para></formalpara>
</listitem> </listitem>
<listitem><formalpara><title>%s</title>
<para>Search term. The value will only be set for documents
with indexed page numbers (ie: PDF). The value will be one of
the matched search terms. It would allow pre-setting the
value in the "Find" entry inside Evince for example, for easy
highlighting of the term.</para></formalpara>
</listitem>
<listitem><formalpara><title>%U, %u</title> <listitem><formalpara><title>%U, %u</title>
<para>Url.</para></formalpara> <para>Url.</para></formalpara>
</listitem> </listitem>

View file

@ -1498,7 +1498,7 @@ static bool lookForHtmlBrowser(string &exefile)
return false; return false;
} }
void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum) void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
{ {
LOGDEB(("RclMain::startNativeViewer: page %d\n", pagenum)); LOGDEB(("RclMain::startNativeViewer: page %d\n", pagenum));
// Look for appropriate viewer // Look for appropriate viewer
@ -1520,10 +1520,13 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum)
if (pagenum == -1) { if (pagenum == -1) {
pagenum = 1; pagenum = 1;
string lterm;
if (m_source.isNotNull()) if (m_source.isNotNull())
pagenum = m_source->getFirstMatchPage(doc); pagenum = m_source->getFirstMatchPage(doc, lterm);
if (pagenum == -1) if (pagenum == -1)
pagenum = 1; pagenum = 1;
else
term = QString::fromUtf8(lterm.c_str());
} }
char cpagenum[20]; char cpagenum[20];
sprintf(cpagenum, "%d", pagenum); sprintf(cpagenum, "%d", pagenum);
@ -1666,6 +1669,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum)
subs["i"] = doc.ipath; subs["i"] = doc.ipath;
subs["M"] = doc.mimetype; subs["M"] = doc.mimetype;
subs["p"] = cpagenum; subs["p"] = cpagenum;
subs["s"] = (const char*)term.toLocal8Bit();
subs["U"] = url; subs["U"] = url;
subs["u"] = url; subs["u"] = url;
// Let %(xx) access all metadata. // Let %(xx) access all metadata.

View file

@ -119,7 +119,8 @@ public slots:
virtual void docExpand(Rcl::Doc); virtual void docExpand(Rcl::Doc);
virtual void startPreview(int docnum, Rcl::Doc doc, int keymods); virtual void startPreview(int docnum, Rcl::Doc doc, int keymods);
virtual void startPreview(Rcl::Doc); virtual void startPreview(Rcl::Doc);
virtual void startNativeViewer(Rcl::Doc, int pagenum = -1); virtual void startNativeViewer(Rcl::Doc, int pagenum = -1,
QString term=QString());
virtual void saveDocToFile(Rcl::Doc); virtual void saveDocToFile(Rcl::Doc);
virtual void previewNextInTab(Preview *, int sid, int docnum); virtual void previewNextInTab(Preview *, int sid, int docnum);
virtual void previewPrevInTab(Preview *, int sid, int docnum); virtual void previewPrevInTab(Preview *, int sid, int docnum);

View file

@ -34,6 +34,7 @@
#include <qclipboard.h> #include <qclipboard.h>
#include <qscrollbar.h> #include <qscrollbar.h>
#include <QTextBlock> #include <QTextBlock>
#include <QShortcut>
#ifndef __APPLE__ #ifndef __APPLE__
#include <qx11info_x11.h> #include <qx11info_x11.h>
#endif #endif
@ -59,9 +60,8 @@
#include "rclaspell.h" #include "rclaspell.h"
#endif #endif
#ifndef MIN static const QKeySequence quitKeySeq("Ctrl+q");
#define MIN(A,B) ((A) < (B) ? (A) : (B)) static const QKeySequence closeKeySeq("Ctrl+w");
#endif
#ifndef RESLIST_TEXTBROWSER #ifndef RESLIST_TEXTBROWSER
#include <QWebFrame> #include <QWebFrame>
@ -805,9 +805,13 @@ void ResList::newSnippetsW(const Rcl::Doc& doc)
{ {
SnippetsW *sp = new SnippetsW(doc, m_source); SnippetsW *sp = new SnippetsW(doc, m_source);
if (m_parent) { if (m_parent) {
connect(sp, SIGNAL(startNativeViewer(Rcl::Doc, int)), connect(sp, SIGNAL(startNativeViewer(Rcl::Doc, int, QString)),
m_parent, SLOT(startNativeViewer(Rcl::Doc, int))); m_parent, SLOT(startNativeViewer(Rcl::Doc, int, QString)));
connect(new QShortcut(quitKeySeq, sp), SIGNAL (activated()),
m_parent, SLOT (fileExit()));
} }
connect(new QShortcut(closeKeySeq, sp), SIGNAL (activated()),
sp, SLOT (close()));
sp->show(); sp->show();
} }

View file

@ -61,7 +61,7 @@ void SnippetsW::init()
setWindowTitle(QString::fromUtf8(titleOrFilename.c_str())); setWindowTitle(QString::fromUtf8(titleOrFilename.c_str()));
vector<pair<int, string> > vpabs; vector<Rcl::Snippet> vpabs;
m_source->getAbstract(m_doc, vpabs); m_source->getAbstract(m_doc, vpabs);
HighlightData hdata; HighlightData hdata;
@ -77,21 +77,23 @@ void SnippetsW::init()
g_hiliter.set_inputhtml(false); g_hiliter.set_inputhtml(false);
for (vector<pair<int, string> >::const_iterator it = vpabs.begin(); for (vector<Rcl::Snippet>::const_iterator it = vpabs.begin();
it != vpabs.end(); it++) { it != vpabs.end(); it++) {
html += "<tr><td>"; html += "<tr><td>";
if (it->first > 0) { if (it->page > 0) {
char buf[100]; char txt[100];
sprintf(buf, "P.&nbsp;%d", it->first); sprintf(txt, "P.&nbsp;%d", it->page);
char url[100];
sprintf(url, "P%dT%s", it->page, it->term.c_str());
html += "<a href=\""; html += "<a href=\"";
html += buf; html += url;
html += "\">"; html += "\">";
html += buf; html += txt;
html += "</a>"; html += "</a>";
} }
html += "</td><td>"; html += "</td><td>";
list<string> lr; list<string> lr;
g_hiliter.plaintorich(it->second, lr, hdata); g_hiliter.plaintorich(it->snippet, lr, hdata);
html.append(QString::fromUtf8(lr.front().c_str())); html.append(QString::fromUtf8(lr.front().c_str()));
html.append("</td></tr>\n"); html.append("</td></tr>\n");
} }
@ -117,7 +119,12 @@ void SnippetsW::linkWasClicked(const QUrl &url)
if (numpos == string::npos) if (numpos == string::npos)
return; return;
int page = atoi(ascurl.c_str() + numpos); int page = atoi(ascurl.c_str() + numpos);
emit startNativeViewer(m_doc, page); string::size_type termpos = ascurl.find_first_of("T");
string term;
if (termpos != string::npos)
term = ascurl.substr(termpos+1);
emit startNativeViewer(m_doc, page,
QString::fromUtf8(term.c_str()));
return; return;
} }
} }

View file

@ -16,6 +16,7 @@
*/ */
#ifndef _SNIPPETS_W_H_INCLUDED_ #ifndef _SNIPPETS_W_H_INCLUDED_
#define _SNIPPETS_W_H_INCLUDED_ #define _SNIPPETS_W_H_INCLUDED_
#include <QString>
#include "rcldoc.h" #include "rcldoc.h"
#include "refcntr.h" #include "refcntr.h"
@ -39,7 +40,7 @@ protected slots:
virtual void linkWasClicked(const QUrl &); virtual void linkWasClicked(const QUrl &);
signals: signals:
void startNativeViewer(Rcl::Doc, int pagenum); void startNativeViewer(Rcl::Doc, int pagenum, QString term);
private: private:
void init(); void init();

View file

@ -25,6 +25,9 @@
#include "refcntr.h" #include "refcntr.h"
#include "hldata.h" #include "hldata.h"
// Need this for the "Snippet" class def.
#include "rclquery.h"
// A result list entry. // A result list entry.
struct ResListEntry { struct ResListEntry {
Rcl::Doc doc; Rcl::Doc doc;
@ -96,13 +99,12 @@ class DocSequence {
return true; return true;
} }
virtual bool getAbstract(Rcl::Doc& doc, virtual bool getAbstract(Rcl::Doc& doc,
std::vector<std::pair<int, std::string> >& abs) std::vector<Rcl::Snippet>& abs)
{ {
abs.push_back(std::pair<int, std::string>(0, abs.push_back(Rcl::Snippet(0, doc.meta[Rcl::Doc::keyabs]));
doc.meta[Rcl::Doc::keyabs]));
return true; return true;
} }
virtual int getFirstMatchPage(Rcl::Doc&) virtual int getFirstMatchPage(Rcl::Doc&, std::string&)
{ {
return -1; return -1;
} }
@ -173,7 +175,7 @@ public:
return m_seq->getAbstract(doc, abs); return m_seq->getAbstract(doc, abs);
} }
virtual bool getAbstract(Rcl::Doc& doc, virtual bool getAbstract(Rcl::Doc& doc,
std::vector<std::pair<int, std::string> >& abs) std::vector<Rcl::Snippet>& abs)
{ {
if (m_seq.isNull()) if (m_seq.isNull())
return false; return false;

View file

@ -64,11 +64,11 @@ int DocSequenceDb::getResCnt()
} }
return m_rescnt; return m_rescnt;
} }
static const string cstr_mre("[...]");
// This one only gets called to fill-up the snippets window // This one only gets called to fill-up the snippets window
// We ignore most abstract/snippets preferences. // We ignore most abstract/snippets preferences.
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
vector<pair<int, string> >& vpabs)
{ {
LOGDEB(("DocSequenceDb::getAbstract/pair\n")); LOGDEB(("DocSequenceDb::getAbstract/pair\n"));
setQuery(); setQuery();
@ -81,11 +81,12 @@ bool DocSequenceDb::getAbstract(Rcl::Doc &doc,
m_q->whatDb()->getAbsCtxLen()+ 2); m_q->whatDb()->getAbsCtxLen()+ 2);
} }
if (vpabs.empty()) if (vpabs.empty())
vpabs.push_back(pair<int, string>(0, doc.meta[Rcl::Doc::keyabs])); vpabs.push_back(Rcl::Snippet(0, doc.meta[Rcl::Doc::keyabs]));
// If the list was probably truncated, indicate it. // If the list was probably truncated, indicate it.
if (ret == Rcl::ABSRES_TRUNC) if (ret == Rcl::ABSRES_TRUNC) {
vpabs.push_back(pair<int, string>(-1, "[...]")); vpabs.push_back(Rcl::Snippet(-1, cstr_mre));
}
return true; return true;
} }
@ -102,11 +103,11 @@ bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<string>& vabs)
return true; return true;
} }
int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc) int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
{ {
setQuery(); setQuery();
if (m_q->whatDb()) { if (m_q->whatDb()) {
return m_q->getFirstMatchPage(doc); return m_q->getFirstMatchPage(doc, term);
} }
return -1; return -1;
} }

View file

@ -34,10 +34,10 @@ class DocSequenceDb : public DocSequence {
// Called to fill-up the snippets window. Ignoers // Called to fill-up the snippets window. Ignoers
// buildabstract/replaceabstract and syntabslen // buildabstract/replaceabstract and syntabslen
virtual bool getAbstract(Rcl::Doc &doc, vector<pair<int, string> >&); virtual bool getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>&);
virtual bool getAbstract(Rcl::Doc &doc, vector<string>&); virtual bool getAbstract(Rcl::Doc &doc, vector<string>&);
virtual int getFirstMatchPage(Rcl::Doc&); virtual int getFirstMatchPage(Rcl::Doc&, std::string& term);
virtual bool getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc); virtual bool getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc);
virtual string getDescription(); virtual string getDescription();
virtual list<string> expand(Rcl::Doc &doc); virtual list<string> expand(Rcl::Doc &doc);

View file

@ -19,6 +19,9 @@
#include <math.h> #include <math.h>
#include <map> #include <map>
#include <tr1/unordered_set>
using std::tr1::unordered_set;
using namespace std; using namespace std;
#include "debuglog.h" #include "debuglog.h"
@ -204,11 +207,11 @@ double Query::Native::qualityTerms(Xapian::docid docid,
} }
// Return page number for first match of "significant" term. // Return page number for first match of "significant" term.
int Query::Native::getFirstMatchPage(Xapian::docid docid) int Query::Native::getFirstMatchPage(Xapian::docid docid, string& term)
{ {
if (!m_q|| !m_q->m_db || !m_q->m_db->m_ndb || !m_q->m_db->m_ndb->m_isopen) { if (!m_q|| !m_q->m_db || !m_q->m_db->m_ndb || !m_q->m_db->m_ndb->m_isopen) {
LOGERR(("Query::getFirstMatchPage: no db\n")); LOGERR(("Query::getFirstMatchPage: no db\n"));
return false; return -1;
} }
Rcl::Db::Native *ndb(m_q->m_db->m_ndb); Rcl::Db::Native *ndb(m_q->m_db->m_ndb);
Xapian::Database& xrdb(ndb->xrdb); Xapian::Database& xrdb(ndb->xrdb);
@ -246,9 +249,11 @@ int Query::Native::getFirstMatchPage(Xapian::docid docid)
for (pos = xrdb.positionlist_begin(docid, qterm); for (pos = xrdb.positionlist_begin(docid, qterm);
pos != xrdb.positionlist_end(docid, qterm); pos++) { pos != xrdb.positionlist_end(docid, qterm); pos++) {
int pagenum = ndb->getPageNumberForPosition(pagepos, *pos); int pagenum = ndb->getPageNumberForPosition(pagepos, *pos);
if (pagenum > 0) if (pagenum > 0) {
term = qterm;
return pagenum; return pagenum;
} }
}
} catch (...) { } catch (...) {
// Term does not occur. No problem. // Term does not occur. No problem.
} }
@ -263,7 +268,7 @@ int Query::Native::getFirstMatchPage(Xapian::docid docid)
// DatabaseModified and other general exceptions are catched and // DatabaseModified and other general exceptions are catched and
// possibly retried by our caller // possibly retried by our caller
abstract_result Query::Native::makeAbstract(Xapian::docid docid, abstract_result Query::Native::makeAbstract(Xapian::docid docid,
vector<pair<int, string> >& vabs, vector<Snippet>& vabs,
int imaxoccs, int ictxwords) int imaxoccs, int ictxwords)
{ {
Chrono chron; Chrono chron;
@ -315,6 +320,9 @@ abstract_result Query::Native::makeAbstract(Xapian::docid docid,
// The terms 'array' that we partially populate with the document // The terms 'array' that we partially populate with the document
// terms, at their positions around the search terms positions: // terms, at their positions around the search terms positions:
map<unsigned int, string> sparseDoc; map<unsigned int, string> sparseDoc;
// Also remember apart the search term positions so that we can list
// them with their snippets.
unordered_set<unsigned int> searchTermPositions;
// Total number of occurences for all terms. We stop when we have too much // Total number of occurences for all terms. We stop when we have too much
unsigned int totaloccs = 0; unsigned int totaloccs = 0;
@ -392,6 +400,7 @@ abstract_result Query::Native::makeAbstract(Xapian::docid docid,
for (unsigned int ii = sta; ii <= sto; ii++) { for (unsigned int ii = sta; ii <= sto; ii++) {
if (ii == (unsigned int)ipos) { if (ii == (unsigned int)ipos) {
sparseDoc[ii] = qterm; sparseDoc[ii] = qterm;
searchTermPositions.insert(ii);
} else if (ii > (unsigned int)ipos && } else if (ii > (unsigned int)ipos &&
ii < (unsigned int)ipos + qtrmwrdcnt) { ii < (unsigned int)ipos + qtrmwrdcnt) {
sparseDoc[ii] = occupiedmarker; sparseDoc[ii] = occupiedmarker;
@ -513,6 +522,7 @@ abstract_result Query::Native::makeAbstract(Xapian::docid docid,
string chunk; string chunk;
bool incjk = false; bool incjk = false;
int page = 0; int page = 0;
string term;
for (map<unsigned int, string>::const_iterator it = sparseDoc.begin(); for (map<unsigned int, string>::const_iterator it = sparseDoc.begin();
it != sparseDoc.end(); it++) { it != sparseDoc.end(); it++) {
LOGDEB2(("Abtract:output %u -> [%s]\n", it->first,it->second.c_str())); LOGDEB2(("Abtract:output %u -> [%s]\n", it->first,it->second.c_str()));
@ -522,6 +532,7 @@ abstract_result Query::Native::makeAbstract(Xapian::docid docid,
page = ndb->getPageNumberForPosition(vpbreaks, it->first); page = ndb->getPageNumberForPosition(vpbreaks, it->first);
if (page < 0) if (page < 0)
page = 0; page = 0;
term.clear();
} }
Utf8Iter uit(it->second); Utf8Iter uit(it->second);
bool newcjk = false; bool newcjk = false;
@ -530,8 +541,10 @@ abstract_result Query::Native::makeAbstract(Xapian::docid docid,
if (!incjk || (incjk && !newcjk)) if (!incjk || (incjk && !newcjk))
chunk += " "; chunk += " ";
incjk = newcjk; incjk = newcjk;
if (searchTermPositions.find(it->first) != searchTermPositions.end())
term = it->second;
if (it->second == cstr_ellipsis) { if (it->second == cstr_ellipsis) {
vabs.push_back(pair<int,string>(page, chunk)); vabs.push_back(Snippet(page, chunk).setTerm(term));
chunk.clear(); chunk.clear();
} else { } else {
if (it->second.compare(end_of_field_term) && if (it->second.compare(end_of_field_term) &&
@ -540,7 +553,7 @@ abstract_result Query::Native::makeAbstract(Xapian::docid docid,
} }
} }
if (!chunk.empty()) if (!chunk.empty())
vabs.push_back(pair<int, string>(page, chunk)); vabs.push_back(Snippet(page, chunk).setTerm(term));
LOGDEB2(("makeAbtract: done in %d mS\n", chron.millis())); LOGDEB2(("makeAbtract: done in %d mS\n", chron.millis()));
return ret; return ret;

View file

@ -300,7 +300,7 @@ bool Query::getMatchTerms(unsigned long xdocid, vector<string>& terms)
} }
abstract_result Query::makeDocAbstract(Doc &doc, abstract_result Query::makeDocAbstract(Doc &doc,
vector<pair<int, string> >& abstract, vector<Snippet>& abstract,
int maxoccs, int ctxwords) int maxoccs, int ctxwords)
{ {
LOGDEB(("makeDocAbstract: maxoccs %d ctxwords %d\n", maxoccs, ctxwords)); LOGDEB(("makeDocAbstract: maxoccs %d ctxwords %d\n", maxoccs, ctxwords));
@ -318,19 +318,19 @@ abstract_result Query::makeDocAbstract(Doc &doc,
bool Query::makeDocAbstract(Doc &doc, vector<string>& abstract) bool Query::makeDocAbstract(Doc &doc, vector<string>& abstract)
{ {
vector<pair<int, string> > vpabs; vector<Snippet> vpabs;
if (!makeDocAbstract(doc, vpabs)) if (!makeDocAbstract(doc, vpabs))
return false; return false;
for (vector<pair<int, string> >::const_iterator it = vpabs.begin(); for (vector<Snippet>::const_iterator it = vpabs.begin();
it != vpabs.end(); it++) { it != vpabs.end(); it++) {
string chunk; string chunk;
if (it->first > 0) { if (it->page > 0) {
doc.haspages = true; doc.haspages = true;
ostringstream ss; ostringstream ss;
ss << it->first; ss << it->page;
chunk += string(" [p ") + ss.str() + "] "; chunk += string(" [p ") + ss.str() + "] ";
} }
chunk += it->second; chunk += it->snippet;
abstract.push_back(chunk); abstract.push_back(chunk);
} }
return true; return true;
@ -338,18 +338,18 @@ bool Query::makeDocAbstract(Doc &doc, vector<string>& abstract)
bool Query::makeDocAbstract(Doc &doc, string& abstract) bool Query::makeDocAbstract(Doc &doc, string& abstract)
{ {
vector<pair<int, string> > vpabs; vector<Snippet> vpabs;
if (!makeDocAbstract(doc, vpabs)) if (!makeDocAbstract(doc, vpabs))
return false; return false;
for (vector<pair<int, string> >::const_iterator it = vpabs.begin(); for (vector<Snippet>::const_iterator it = vpabs.begin();
it != vpabs.end(); it++) { it != vpabs.end(); it++) {
abstract.append(it->second); abstract.append(it->snippet);
abstract.append(cstr_ellipsis); abstract.append(cstr_ellipsis);
} }
return m_reason.empty() ? true : false; return m_reason.empty() ? true : false;
} }
int Query::getFirstMatchPage(Doc &doc) int Query::getFirstMatchPage(Doc &doc, string& term)
{ {
LOGDEB1(("Db::getFirstMatchPages\n"));; LOGDEB1(("Db::getFirstMatchPages\n"));;
if (!m_nq) { if (!m_nq) {
@ -357,7 +357,7 @@ int Query::getFirstMatchPage(Doc &doc)
return false; return false;
} }
int pagenum = -1; int pagenum = -1;
XAPTRY(pagenum = m_nq->getFirstMatchPage(Xapian::docid(doc.xdocid)), XAPTRY(pagenum = m_nq->getFirstMatchPage(Xapian::docid(doc.xdocid), term),
m_db->m_ndb->xrdb, m_reason); m_db->m_ndb->xrdb, m_reason);
return m_reason.empty() ? pagenum : -1; return m_reason.empty() ? pagenum : -1;
} }

View file

@ -25,12 +25,12 @@ using std::vector;
#endif #endif
#include "refcntr.h" #include "refcntr.h"
#include "searchdata.h"
#ifndef NO_NAMESPACES #ifndef NO_NAMESPACES
namespace Rcl { namespace Rcl {
#endif #endif
class SearchData;
class Db; class Db;
class Doc; class Doc;
@ -40,6 +40,24 @@ enum abstract_result {
ABSRES_TRUNC = 2 ABSRES_TRUNC = 2
}; };
// Snippet entry for makeDocAbstract
class Snippet {
public:
Snippet(int page, const string& snip)
: page(page), snippet(snip)
{
}
Snippet& setTerm(const string& trm)
{
term = trm;
return *this;
}
int page;
string term;
string snippet;
};
/** /**
* An Rcl::Query is a question (SearchData) applied to a * An Rcl::Query is a question (SearchData) applied to a
* database. Handles access to the results. Somewhat equivalent to a * database. Handles access to the results. Somewhat equivalent to a
@ -89,10 +107,10 @@ class Query {
// Returned as a snippets vector // Returned as a snippets vector
bool makeDocAbstract(Doc &doc, vector<string>& abstract); bool makeDocAbstract(Doc &doc, vector<string>& abstract);
// Returned as a vector of pair<page,snippet> page is 0 if unknown // Returned as a vector of pair<page,snippet> page is 0 if unknown
abstract_result makeDocAbstract(Doc &doc, vector<pair<int, string> >& abst, abstract_result makeDocAbstract(Doc &doc, vector<Snippet>& abst,
int maxoccs= -1, int ctxwords = -1); int maxoccs= -1, int ctxwords = -1);
/** Retrieve detected page breaks positions */ /** Retrieve detected page breaks positions */
int getFirstMatchPage(Doc &doc); int getFirstMatchPage(Doc &doc, std::string& term);
/** Expand query to look for documents like the one passed in */ /** Expand query to look for documents like the one passed in */
vector<string> expand(const Doc &doc); vector<string> expand(const Doc &doc);

View file

@ -54,9 +54,9 @@ public:
delete xenquire; xenquire = 0; delete xenquire; xenquire = 0;
termfreqs.clear(); termfreqs.clear();
} }
abstract_result makeAbstract(Xapian::docid id, vector<pair<int, string> >&, abstract_result makeAbstract(Xapian::docid id, vector<Snippet>&,
int maxoccs = -1, int ctxwords = -1); int maxoccs = -1, int ctxwords = -1);
int getFirstMatchPage(Xapian::docid docid); int getFirstMatchPage(Xapian::docid docid, std::string& term);
void setDbWideQTermsFreqs(); void setDbWideQTermsFreqs();
double qualityTerms(Xapian::docid docid, double qualityTerms(Xapian::docid docid,
const std::vector<std::string>& terms, const std::vector<std::string>& terms,