try to limit the places which use Rcl:: stuff
This commit is contained in:
parent
6b394537b2
commit
ddb1bdca07
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.19 2006-12-11 14:56:38 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.20 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -68,8 +68,9 @@ class myTextSplitCB : public TextSplitCB {
|
|||||||
// Out: begin and end byte positions of query terms/groups in text
|
// Out: begin and end byte positions of query terms/groups in text
|
||||||
vector<pair<int, int> > tboffs;
|
vector<pair<int, int> > tboffs;
|
||||||
|
|
||||||
myTextSplitCB(const vector<string>& its, vector<vector<string> >&groups,
|
myTextSplitCB(const vector<string>& its,
|
||||||
vector<int>& slacks)
|
const vector<vector<string> >&groups,
|
||||||
|
const vector<int>& slacks)
|
||||||
: firstTermOcc(1), m_wcount(0), m_groups(groups), m_slacks(slacks)
|
: firstTermOcc(1), m_wcount(0), m_groups(groups), m_slacks(slacks)
|
||||||
{
|
{
|
||||||
for (vector<string>::const_iterator it = its.begin();
|
for (vector<string>::const_iterator it = its.begin();
|
||||||
@ -316,16 +317,14 @@ const char *firstTermBeacon = "\xe2\xa0\x91\xe2\x96\x9f\x20\x01\x9a";
|
|||||||
// we return the first term encountered, and the caller will use the
|
// we return the first term encountered, and the caller will use the
|
||||||
// editor's find() function to position on it
|
// editor's find() function to position on it
|
||||||
bool plaintorich(const string& in, string& out,
|
bool plaintorich(const string& in, string& out,
|
||||||
RefCntr<Rcl::SearchData> sdata,
|
const HiliteData& hdata,
|
||||||
bool noHeader, bool fft)
|
bool noHeader, bool fft)
|
||||||
{
|
{
|
||||||
Chrono chron;
|
Chrono chron;
|
||||||
out.erase();
|
out.erase();
|
||||||
vector<string> terms;
|
const vector<string>& terms(hdata.terms);
|
||||||
vector<vector<string> > groups;
|
const vector<vector<string> >& groups(hdata.groups);
|
||||||
vector<int> slacks;
|
const vector<int>& slacks(hdata.gslks);
|
||||||
|
|
||||||
sdata->getTerms(terms, groups, slacks);
|
|
||||||
|
|
||||||
if (DebugLog::getdbl()->getlevel() >= DEBDEB0) {
|
if (DebugLog::getdbl()->getlevel() >= DEBDEB0) {
|
||||||
LOGDEB0(("plaintorich: terms: \n"));
|
LOGDEB0(("plaintorich: terms: \n"));
|
||||||
@ -333,7 +332,7 @@ bool plaintorich(const string& in, string& out,
|
|||||||
LOGDEB0((" %s\n", sterms.c_str()));
|
LOGDEB0((" %s\n", sterms.c_str()));
|
||||||
sterms = "\n";
|
sterms = "\n";
|
||||||
LOGDEB0(("plaintorich: groups: \n"));
|
LOGDEB0(("plaintorich: groups: \n"));
|
||||||
for (vector<vector<string> >::iterator vit = groups.begin();
|
for (vector<vector<string> >::const_iterator vit = groups.begin();
|
||||||
vit != groups.end(); vit++) {
|
vit != groups.end(); vit++) {
|
||||||
sterms += vecStringToString(*vit);
|
sterms += vecStringToString(*vit);
|
||||||
sterms += "\n";
|
sterms += "\n";
|
||||||
|
|||||||
@ -16,11 +16,16 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _PLAINTORICH_H_INCLUDED_
|
#ifndef _PLAINTORICH_H_INCLUDED_
|
||||||
#define _PLAINTORICH_H_INCLUDED_
|
#define _PLAINTORICH_H_INCLUDED_
|
||||||
/* @(#$Id: plaintorich.h,v 1.11 2006-11-30 13:38:44 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: plaintorich.h,v 1.12 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "searchdata.h"
|
// A data struct to hold words and groups of words to be highlighted
|
||||||
|
struct HiliteData {
|
||||||
|
vector<string> terms;
|
||||||
|
vector<vector<string> > groups;
|
||||||
|
vector<int> gslks; // group slacks (number of permitted non-matched words)
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform plain text into qt rich text for the preview window.
|
* Transform plain text into qt rich text for the preview window.
|
||||||
@ -31,13 +36,13 @@
|
|||||||
*
|
*
|
||||||
* @param in raw text out of internfile.
|
* @param in raw text out of internfile.
|
||||||
* @param out rich text output
|
* @param out rich text output
|
||||||
* @param terms list of query terms. These are out of Rcl::Db and dumb
|
* @param hdata terms and groups to be highlighted. These are
|
||||||
* @param firstTerm out: value of the first search term in text.
|
* lowercase and unaccented.
|
||||||
* @param frsttocc out: occurrence of 1st term to look for
|
|
||||||
* @param noHeader if true don't output header (<qt><title>...)
|
* @param noHeader if true don't output header (<qt><title>...)
|
||||||
|
* @param fft If true mark the first term position in the text
|
||||||
*/
|
*/
|
||||||
extern bool plaintorich(const string &in, string &out,
|
extern bool plaintorich(const string &in, string &out,
|
||||||
RefCntr<Rcl::SearchData> sdata,
|
const HiliteData& hdata,
|
||||||
bool noHeader = false,
|
bool noHeader = false,
|
||||||
bool fft = false);
|
bool fft = false);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.13 2006-12-20 14:09:21 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.14 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -497,12 +497,12 @@ class LoadThread : public QThread {
|
|||||||
/* A thread to convert to rich text (mark search terms) */
|
/* A thread to convert to rich text (mark search terms) */
|
||||||
class ToRichThread : public QThread {
|
class ToRichThread : public QThread {
|
||||||
string ∈
|
string ∈
|
||||||
RefCntr<Rcl::SearchData> m_searchData;
|
const HiliteData &hdata;
|
||||||
QString &out;
|
QString &out;
|
||||||
int loglevel;
|
int loglevel;
|
||||||
public:
|
public:
|
||||||
ToRichThread(string &i, RefCntr<Rcl::SearchData> searchData, QString &o)
|
ToRichThread(string &i, const HiliteData& hd, QString &o)
|
||||||
: in(i), m_searchData(searchData), out(o)
|
: in(i), hdata(hd), out(o)
|
||||||
{
|
{
|
||||||
loglevel = DebugLog::getdbl()->getlevel();
|
loglevel = DebugLog::getdbl()->getlevel();
|
||||||
}
|
}
|
||||||
@ -511,7 +511,7 @@ class ToRichThread : public QThread {
|
|||||||
DebugLog::getdbl()->setloglevel(loglevel);
|
DebugLog::getdbl()->setloglevel(loglevel);
|
||||||
string rich;
|
string rich;
|
||||||
try {
|
try {
|
||||||
plaintorich(in, rich, m_searchData, false, true);
|
plaintorich(in, rich, hdata, false, true);
|
||||||
} catch (CancelExcept) {
|
} catch (CancelExcept) {
|
||||||
}
|
}
|
||||||
out = QString::fromUtf8(rich.c_str(), rich.length());
|
out = QString::fromUtf8(rich.c_str(), rich.length());
|
||||||
@ -599,7 +599,7 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
|
|||||||
bool highlightTerms = fdoc.text.length() < 1000 *1024;
|
bool highlightTerms = fdoc.text.length() < 1000 *1024;
|
||||||
if (highlightTerms) {
|
if (highlightTerms) {
|
||||||
progress.setLabelText(tr("Creating preview text"));
|
progress.setLabelText(tr("Creating preview text"));
|
||||||
ToRichThread rthr(fdoc.text, m_searchData, richTxt);
|
ToRichThread rthr(fdoc.text, m_hData, richTxt);
|
||||||
rthr.start();
|
rthr.start();
|
||||||
|
|
||||||
for (;;prog++) {
|
for (;;prog++) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _PREVIEW_W_H_INCLUDED_
|
#ifndef _PREVIEW_W_H_INCLUDED_
|
||||||
#define _PREVIEW_W_H_INCLUDED_
|
#define _PREVIEW_W_H_INCLUDED_
|
||||||
/* @(#$Id: preview_w.h,v 1.7 2006-12-04 09:56:26 dockes Exp $ (C) 2006 J.F.Dockes */
|
/* @(#$Id: preview_w.h,v 1.8 2007-01-19 15:22:50 dockes Exp $ (C) 2006 J.F.Dockes */
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#define QTextEdit Q3TextEdit
|
#define QTextEdit Q3TextEdit
|
||||||
#endif
|
#endif
|
||||||
#include "refcntr.h"
|
#include "refcntr.h"
|
||||||
#include "searchdata.h"
|
#include "plaintorich.h"
|
||||||
|
|
||||||
// We keep a list of data associated to each tab
|
// We keep a list of data associated to each tab
|
||||||
class TabData {
|
class TabData {
|
||||||
@ -69,10 +69,10 @@ public:
|
|||||||
|
|
||||||
~Preview(){}
|
~Preview(){}
|
||||||
|
|
||||||
virtual void setSId(int sid, RefCntr<Rcl::SearchData> sdata)
|
virtual void setSId(int sid, const HiliteData& hdata)
|
||||||
{
|
{
|
||||||
m_searchId = sid;
|
m_searchId = sid;
|
||||||
m_searchData = sdata;
|
m_hData = hdata;
|
||||||
}
|
}
|
||||||
virtual void closeEvent( QCloseEvent *e );
|
virtual void closeEvent( QCloseEvent *e );
|
||||||
virtual bool eventFilter( QObject *target, QEvent *event );
|
virtual bool eventFilter( QObject *target, QEvent *event );
|
||||||
@ -111,7 +111,7 @@ private:
|
|||||||
bool canBeep;
|
bool canBeep;
|
||||||
list<TabData> tabData;
|
list<TabData> tabData;
|
||||||
QWidget *currentW;
|
QWidget *currentW;
|
||||||
RefCntr<Rcl::SearchData> m_searchData;
|
HiliteData m_hData;
|
||||||
void init();
|
void init();
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
TabData *tabDataForCurrent(); // Return auxiliary data pointer for cur tab
|
TabData *tabDataForCurrent(); // Return auxiliary data pointer for cur tab
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.23 2007-01-19 10:32:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.24 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -380,8 +380,10 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
|
DocSequenceDb *src =
|
||||||
|
new DocSequenceDb(rcldb, string(tr("Query results").utf8()), sdata);
|
||||||
|
m_docSource = RefCntr<DocSequence>(src);
|
||||||
m_searchData = sdata;
|
m_searchData = sdata;
|
||||||
m_docSource = RefCntr<DocSequence>(new DocSequenceDb(rcldb, string(tr("Query results").utf8())));
|
|
||||||
setDocSequence();
|
setDocSequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +406,7 @@ void RclMain::setDocSequence()
|
|||||||
docsource = m_docSource;
|
docsource = m_docSource;
|
||||||
}
|
}
|
||||||
m_searchId++;
|
m_searchId++;
|
||||||
resList->setDocSource(docsource, m_searchData);
|
resList->setDocSource(docsource);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open advanced search dialog.
|
// Open advanced search dialog.
|
||||||
@ -531,7 +533,9 @@ void RclMain::startPreview(int docnum, int mod)
|
|||||||
QMessageBox::NoButton);
|
QMessageBox::NoButton);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
curPreview->setSId(m_searchId, resList->getSearchData());
|
HiliteData hdata;
|
||||||
|
m_searchData->getTerms(hdata.terms, hdata.groups, hdata.gslks);
|
||||||
|
curPreview->setSId(m_searchId, hdata);
|
||||||
curPreview->setCaption(resList->getDescription());
|
curPreview->setCaption(resList->getDescription());
|
||||||
connect(curPreview, SIGNAL(previewClosed(QWidget *)),
|
connect(curPreview, SIGNAL(previewClosed(QWidget *)),
|
||||||
this, SLOT(previewClosed(QWidget *)));
|
this, SLOT(previewClosed(QWidget *)));
|
||||||
@ -582,8 +586,7 @@ void RclMain::startPreview(Rcl::Doc doc)
|
|||||||
QMessageBox::NoButton);
|
QMessageBox::NoButton);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RefCntr<Rcl::SearchData> searchdata(new Rcl::SearchData(Rcl::SCLT_AND));
|
preview->setSId(0, HiliteData());
|
||||||
preview->setSId(0, searchdata);
|
|
||||||
connect(preview, SIGNAL(wordSelect(QString)),
|
connect(preview, SIGNAL(wordSelect(QString)),
|
||||||
this, SLOT(ssearchAddTerm(QString)));
|
this, SLOT(ssearchAddTerm(QString)));
|
||||||
g_dynconf->enterDoc(fn, doc.ipath);
|
g_dynconf->enterDoc(fn, doc.ipath);
|
||||||
@ -868,9 +871,11 @@ void RclMain::showDocHistory()
|
|||||||
|
|
||||||
m_searchId++;
|
m_searchId++;
|
||||||
|
|
||||||
m_docSource = RefCntr<DocSequence>(new DocSequenceHistory(rcldb,
|
DocSequenceHistory *src =
|
||||||
g_dynconf,
|
new DocSequenceHistory(rcldb, g_dynconf,
|
||||||
string(tr("Document history").utf8())));
|
string(tr("Document history").utf8()));
|
||||||
|
src->setDescription((const char *)tr("History data").utf8());
|
||||||
|
m_docSource = RefCntr<DocSequence>(src);
|
||||||
setDocSequence();
|
setDocSequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.20 2007-01-19 10:32:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.21 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -85,12 +85,10 @@ void ResList::languageChange()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Acquire new docsource
|
// Acquire new docsource
|
||||||
void ResList::setDocSource(RefCntr<DocSequence> docsource,
|
void ResList::setDocSource(RefCntr<DocSequence> docsource)
|
||||||
RefCntr<Rcl::SearchData> sdt)
|
|
||||||
{
|
{
|
||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
m_docSource = docsource;
|
m_docSource = docsource;
|
||||||
m_searchData = sdt;
|
|
||||||
m_curPvDoc = -1;
|
m_curPvDoc = -1;
|
||||||
|
|
||||||
resultPageNext();
|
resultPageNext();
|
||||||
@ -351,6 +349,9 @@ void ResList::resultPageNext()
|
|||||||
|
|
||||||
append(chunk);
|
append(chunk);
|
||||||
|
|
||||||
|
HiliteData hdata;
|
||||||
|
m_docSource->getTerms(hdata.terms, hdata.groups, hdata.gslks);
|
||||||
|
|
||||||
// Insert results in result list window. We have to actually send
|
// Insert results in result list window. We have to actually send
|
||||||
// the text to the widget (instead of setting the whole at the
|
// the text to the widget (instead of setting the whole at the
|
||||||
// end), because we need the paragraph number each time we add a
|
// end), because we need the paragraph number each time we add a
|
||||||
@ -443,7 +444,7 @@ void ResList::resultPageNext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
string richabst;
|
string richabst;
|
||||||
plaintorich(abstract, richabst, m_searchData, true);
|
plaintorich(abstract, richabst, hdata, true);
|
||||||
|
|
||||||
// Links;
|
// Links;
|
||||||
string linksbuf;
|
string linksbuf;
|
||||||
@ -682,7 +683,7 @@ void ResList::menuExpand()
|
|||||||
|
|
||||||
QString ResList::getDescription()
|
QString ResList::getDescription()
|
||||||
{
|
{
|
||||||
return QString::fromUtf8(m_searchData->getDescription().c_str());
|
return QString::fromUtf8(m_docSource->getDescription().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Show detailed expansion of a query */
|
/** Show detailed expansion of a query */
|
||||||
@ -692,7 +693,7 @@ void ResList::showQueryDetails()
|
|||||||
// Also limit the total number of lines.
|
// Also limit the total number of lines.
|
||||||
const unsigned int ll = 100;
|
const unsigned int ll = 100;
|
||||||
const unsigned int maxlines = 50;
|
const unsigned int maxlines = 50;
|
||||||
string query = m_searchData->getDescription();
|
string query = m_docSource->getDescription();
|
||||||
string oq;
|
string oq;
|
||||||
unsigned int nlines = 0;
|
unsigned int nlines = 0;
|
||||||
while (query.length() > 0) {
|
while (query.length() > 0) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _RESLIST_H_INCLUDED_
|
#ifndef _RESLIST_H_INCLUDED_
|
||||||
#define _RESLIST_H_INCLUDED_
|
#define _RESLIST_H_INCLUDED_
|
||||||
/* @(#$Id: reslist.h,v 1.8 2007-01-08 10:01:55 dockes Exp $ (C) 2005 J.F.Dockes */
|
/* @(#$Id: reslist.h,v 1.9 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -20,12 +20,9 @@ class Q3PopupMenu;
|
|||||||
#define QTEXTBROWSER Q3TextBrowser
|
#define QTEXTBROWSER Q3TextBrowser
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rcldb.h"
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "searchdata.h"
|
|
||||||
#include "refcntr.h"
|
#include "refcntr.h"
|
||||||
|
|
||||||
|
|
||||||
class ResList : public QTEXTBROWSER
|
class ResList : public QTEXTBROWSER
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
@ -40,12 +37,10 @@ class ResList : public QTEXTBROWSER
|
|||||||
// num is inside the current page or its immediate neighbours.
|
// num is inside the current page or its immediate neighbours.
|
||||||
virtual bool getDoc(int docnum, Rcl::Doc &);
|
virtual bool getDoc(int docnum, Rcl::Doc &);
|
||||||
|
|
||||||
virtual void setDocSource(RefCntr<DocSequence> source,
|
virtual void setDocSource(RefCntr<DocSequence> source);
|
||||||
RefCntr<Rcl::SearchData> qdata);
|
|
||||||
virtual RCLPOPUP *createPopupMenu(const QPoint& pos);
|
virtual RCLPOPUP *createPopupMenu(const QPoint& pos);
|
||||||
virtual QString getDescription(); // Printable actual query performed on db
|
virtual QString getDescription(); // Printable actual query performed on db
|
||||||
virtual int getResCnt(); // Return total result list size
|
virtual int getResCnt(); // Return total result list size
|
||||||
virtual RefCntr<Rcl::SearchData> getSearchData() {return m_searchData;}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void resetSearch();
|
virtual void resetSearch();
|
||||||
@ -86,7 +81,6 @@ class ResList : public QTEXTBROWSER
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<int,int> m_pageParaToReldocnums;
|
std::map<int,int> m_pageParaToReldocnums;
|
||||||
RefCntr<Rcl::SearchData> m_searchData;
|
|
||||||
RefCntr<DocSequence> m_docSource;
|
RefCntr<DocSequence> m_docSource;
|
||||||
std::vector<Rcl::Doc> m_curDocs;
|
std::vector<Rcl::Doc> m_curDocs;
|
||||||
int m_winfirst;
|
int m_winfirst;
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _DOCSEQ_H_INCLUDED_
|
#ifndef _DOCSEQ_H_INCLUDED_
|
||||||
#define _DOCSEQ_H_INCLUDED_
|
#define _DOCSEQ_H_INCLUDED_
|
||||||
/* @(#$Id: docseq.h,v 1.10 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: docseq.h,v 1.11 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -79,9 +79,16 @@ class DocSequence {
|
|||||||
/** Get title for result list */
|
/** Get title for result list */
|
||||||
virtual string title() {return m_title;}
|
virtual string title() {return m_title;}
|
||||||
|
|
||||||
|
/** Get description for underlying query */
|
||||||
|
virtual string getDescription() = 0;
|
||||||
|
|
||||||
/** Get search terms (for highlighting abstracts). Some sequences
|
/** Get search terms (for highlighting abstracts). Some sequences
|
||||||
* may have no associated search terms. Implement this for them. */
|
* may have no associated search terms. Implement this for them. */
|
||||||
virtual void getTerms(list<string>& t) {t.clear();}
|
virtual bool getTerms(vector<string>& terms,
|
||||||
|
vector<vector<string> >& groups,
|
||||||
|
vector<int>& gslks) const {
|
||||||
|
terms.clear(); groups.clear(); gslks.clear(); return true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string m_title;
|
string m_title;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.1 2007-01-19 10:32:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.2 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -39,13 +39,6 @@ int DocSequenceDb::getResCnt()
|
|||||||
return m_rescnt;
|
return m_rescnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocSequenceDb::getTerms(list<string> &terms)
|
|
||||||
{
|
|
||||||
if (!m_db)
|
|
||||||
return;
|
|
||||||
m_db->getQueryTerms(terms);
|
|
||||||
}
|
|
||||||
|
|
||||||
string DocSequenceDb::getAbstract(Rcl::Doc &doc)
|
string DocSequenceDb::getAbstract(Rcl::Doc &doc)
|
||||||
{
|
{
|
||||||
if (!m_db)
|
if (!m_db)
|
||||||
|
|||||||
@ -16,35 +16,35 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _DOCSEQDB_H_INCLUDED_
|
#ifndef _DOCSEQDB_H_INCLUDED_
|
||||||
#define _DOCSEQDB_H_INCLUDED_
|
#define _DOCSEQDB_H_INCLUDED_
|
||||||
/* @(#$Id: docseqdb.h,v 1.1 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: docseqdb.h,v 1.2 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#ifndef NO_NAMESPACES
|
|
||||||
using std::string;
|
|
||||||
using std::list;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
namespace Rcl {
|
#include "refcntr.h"
|
||||||
class Db;
|
|
||||||
}
|
#include "searchdata.h"
|
||||||
|
|
||||||
/** A DocSequence from a Db query (there should be one active for this
|
/** A DocSequence from a Db query (there should be one active for this
|
||||||
to make sense */
|
to make sense) */
|
||||||
class DocSequenceDb : public DocSequence {
|
class DocSequenceDb : public DocSequence {
|
||||||
public:
|
public:
|
||||||
DocSequenceDb(Rcl::Db *d, const string &t) :
|
DocSequenceDb(Rcl::Db *d, const string &t, RefCntr<Rcl::SearchData> sdata)
|
||||||
DocSequence(t), m_db(d), m_rescnt(-1)
|
: DocSequence(t), m_db(d), m_sdata(sdata), m_rescnt(-1)
|
||||||
{}
|
{}
|
||||||
virtual ~DocSequenceDb() {}
|
virtual ~DocSequenceDb() {}
|
||||||
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string * = 0);
|
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string * = 0);
|
||||||
virtual int getResCnt();
|
virtual int getResCnt();
|
||||||
virtual void getTerms(list<string>&);
|
virtual bool getTerms(vector<string>& terms,
|
||||||
|
vector<vector<string> >& groups,
|
||||||
|
vector<int>& gslks) const {
|
||||||
|
return m_sdata.getptr()->getTerms(terms, groups, gslks);
|
||||||
|
}
|
||||||
|
|
||||||
virtual string getAbstract(Rcl::Doc &doc);
|
virtual string getAbstract(Rcl::Doc &doc);
|
||||||
|
virtual string getDescription() {return m_sdata->getDescription();}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Rcl::Db *m_db;
|
Rcl::Db *m_db;
|
||||||
int m_rescnt;
|
RefCntr<Rcl::SearchData> m_sdata;
|
||||||
|
int m_rescnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _DOCSEQDB_H_INCLUDED_ */
|
#endif /* _DOCSEQDB_H_INCLUDED_ */
|
||||||
|
|||||||
@ -16,20 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _DOCSEQHIST_H_INCLUDED_
|
#ifndef _DOCSEQHIST_H_INCLUDED_
|
||||||
#define _DOCSEQHIST_H_INCLUDED_
|
#define _DOCSEQHIST_H_INCLUDED_
|
||||||
/* @(#$Id: docseqhist.h,v 1.1 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: docseqhist.h,v 1.2 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#ifndef NO_NAMESPACES
|
|
||||||
using std::string;
|
|
||||||
using std::list;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
|
||||||
namespace Rcl {
|
namespace Rcl {
|
||||||
class Db;
|
class Db;
|
||||||
}
|
}
|
||||||
class RclHistory;
|
|
||||||
|
|
||||||
/** A DocSequence coming from the history file.
|
/** A DocSequence coming from the history file.
|
||||||
* History is kept as a list of urls. This queries the db to fetch
|
* History is kept as a list of urls. This queries the db to fetch
|
||||||
@ -42,12 +36,14 @@ class DocSequenceHistory : public DocSequence {
|
|||||||
|
|
||||||
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
|
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
|
||||||
virtual int getResCnt();
|
virtual int getResCnt();
|
||||||
|
virtual string getDescription() {return m_description;}
|
||||||
|
void setDescription(const string& desc) {m_description = desc;}
|
||||||
private:
|
private:
|
||||||
Rcl::Db *m_db;
|
Rcl::Db *m_db;
|
||||||
RclHistory *m_hist;
|
RclHistory *m_hist;
|
||||||
int m_prevnum;
|
int m_prevnum;
|
||||||
long m_prevtime;
|
long m_prevtime;
|
||||||
|
string m_description; // This is just an nls translated 'doc history'
|
||||||
list<RclDHistoryEntry> m_hlist;
|
list<RclDHistoryEntry> m_hlist;
|
||||||
list<RclDHistoryEntry>::const_iterator m_it;
|
list<RclDHistoryEntry>::const_iterator m_it;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.10 2007-01-19 10:32:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.11 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -120,8 +120,3 @@ bool DocSeqSorted::getDoc(int num, Rcl::Doc &doc, int *percent, string *)
|
|||||||
doc = *m_docsp[num];
|
doc = *m_docsp[num];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string DocSeqSorted::getAbstract(Rcl::Doc& doc)
|
|
||||||
{
|
|
||||||
return m_seq->getAbstract(doc);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _SORTSEQ_H_INCLUDED_
|
#ifndef _SORTSEQ_H_INCLUDED_
|
||||||
#define _SORTSEQ_H_INCLUDED_
|
#define _SORTSEQ_H_INCLUDED_
|
||||||
/* @(#$Id: sortseq.h,v 1.9 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: sortseq.h,v 1.10 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -48,7 +48,10 @@ class DocSeqSorted : public DocSequence {
|
|||||||
virtual ~DocSeqSorted() {}
|
virtual ~DocSeqSorted() {}
|
||||||
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
|
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
|
||||||
virtual int getResCnt() {return m_spec.sortwidth;}
|
virtual int getResCnt() {return m_spec.sortwidth;}
|
||||||
virtual string getAbstract(Rcl::Doc& doc);
|
virtual string getAbstract(Rcl::Doc& doc) {
|
||||||
|
return m_seq->getAbstract(doc);
|
||||||
|
}
|
||||||
|
virtual string getDescription() {return m_seq->getDescription();}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefCntr<DocSequence> m_seq;
|
RefCntr<DocSequence> m_seq;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user