move stemlang from RclQuery to SearchData. Allow DocSequences to do the sorting/filtering themselves

This commit is contained in:
dockes 2008-09-29 11:33:55 +00:00
parent 828dff3bb1
commit f0538b15f2
16 changed files with 166 additions and 97 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.9 2008-09-29 08:59:20 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.10 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <stdio.h>
@ -110,7 +110,7 @@ void RecollProtocol::get(const KURL & url)
sdata->addClause(new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND,
(const char *)u8));
Rcl::Query *query = new Rcl::Query(m_rcldb);
if (!query->setQuery(sdata, Rcl::Db::QO_STEM, "english")) {
if (!query->setQuery(sdata)) {
m_reason = "Internal Error: setQuery failed";
outputError(m_reason.c_str());
finished();

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: pyrecoll.cpp,v 1.15 2008-09-29 08:59:20 dockes Exp $ (C) 2007 J.F.Dockes";
static char rcsid[] = "@(#$Id: pyrecoll.cpp,v 1.16 2008-09-29 11:33:55 dockes Exp $ (C) 2007 J.F.Dockes";
#endif
@ -617,9 +617,14 @@ Query_execute(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
PyErr_SetString(PyExc_ValueError, reason.c_str());
return 0;
}
// SearchData defaults to stemming in english
// Use default for now but need to add way to specify language
if (!dostem)
sd->setStemlang("");
RefCntr<Rcl::SearchData> rq(sd);
self->query->setSortBy(self->sortfield, self->ascending);
self->query->setQuery(rq, dostem?Rcl::Query::QO_STEM:Rcl::Query::QO_NONE);
self->query->setQuery(rq);
int cnt = self->query->getResCnt();
self->next = 0;
return Py_BuildValue("i", cnt);

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.53 2008-09-28 14:20:50 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.54 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -99,7 +99,8 @@ void RclMain::init()
static const char* catg_strings[] = {
QT_TR_NOOP("All"), QT_TR_NOOP("media"), QT_TR_NOOP("message"),
QT_TR_NOOP("other"), QT_TR_NOOP("presentation"),
QT_TR_NOOP("spreadsheet"), QT_TR_NOOP("text")
QT_TR_NOOP("spreadsheet"), QT_TR_NOOP("text"),
QT_TR_NOOP("sorted"), QT_TR_NOOP("filtered")
};
curPreview = 0;
@ -457,19 +458,17 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
}
resList->resetList();
int qopts = 0;
if (!prefs.queryStemLang.length() == 0)
qopts |= Rcl::Query::QO_STEM;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
string stemLang = (const char *)prefs.queryStemLang.ascii();
if (stemLang == "ALL") {
rclconfig->getConfParam("indexstemminglanguages", stemLang);
}
sdata->setStemlang(stemLang);
Rcl::Query *query = new Rcl::Query(rcldb);
if (!query || !query->setQuery(sdata, qopts, stemLang)) {
if (!query || !query->setQuery(sdata)) {
QMessageBox::warning(0, "Recoll", tr("Can't start query: ") +
QString::fromAscii(query->getReason().c_str()));
QApplication::restoreOverrideCursor();

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.46 2008-09-29 08:59:20 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.47 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <time.h>
@ -113,16 +113,24 @@ void ResList::setDocSource()
// Filtering must be done before sorting, (which usually
// truncates the original list)
if (m_filtspecs.isNotNull()) {
m_docSource =
RefCntr<DocSequence>(new DocSeqFiltered(m_docSource,
m_filtspecs, ""));
if (m_baseDocSource->canFilter()) {
m_baseDocSource->setFiltSpec(m_filtspecs);
} else {
if (m_filtspecs.isNotNull()) {
string title = m_baseDocSource->title() + " (" +
string((const char*)tr("filtered").utf8()) + ")";
m_docSource =
RefCntr<DocSequence>(new DocSeqFiltered(m_docSource,m_filtspecs,
title));
}
}
if (m_sortspecs.isNotNull()) {
string title = m_baseDocSource->title() + " (" +
string((const char *)tr("sorted").utf8()) + ")";
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(m_docSource,
m_sortspecs,
string(tr("Query results (sorted)").utf8())));
title));
}
resultPageNext();
}
@ -162,10 +170,10 @@ void ResList::resetList()
bool ResList::displayingHistory()
{
// We want to reset the displayed history if it is currently shown. Using
// the title value is an ugly hack
return m_docSource->title() ==
string((const char *)tr("Document history").utf8());
// We want to reset the displayed history if it is currently
// shown. Using the title value is an ugly hack
string htstring = string((const char *)tr("Document history").utf8());
return m_docSource->title().find(htstring) == 0;
}
void ResList::languageChange()

View File

@ -16,7 +16,7 @@
*/
#ifndef _DOCSEQ_H_INCLUDED_
#define _DOCSEQ_H_INCLUDED_
/* @(#$Id: docseq.h,v 1.16 2008-09-29 08:59:20 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: docseq.h,v 1.17 2008-09-29 11:33:55 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
#include <vector>
@ -34,10 +34,48 @@ struct ResListEntry {
string subHeader;
};
/** Sort specification. Will be made closer to the db interface one day */
class DocSeqSortSpec {
public:
DocSeqSortSpec() : sortdepth(0) {}
enum Field {RCLFLD_MIMETYPE, RCLFLD_MTIME};
void addCrit(Field fld, bool desc = false) {
crits.push_back(fld);
dirs.push_back(desc);
}
bool isNotNull() {return sortdepth > 0;}
int sortdepth; // We only re-sort the first sortdepth most relevant docs
std::vector<Field> crits;
std::vector<bool> dirs;
};
/** Filtering spec. This is only used to filter by doc category for now, hence
the rather specialized interface */
class DocSeqFiltSpec {
public:
DocSeqFiltSpec() {}
enum Crit {DSFS_MIMETYPE};
void orCrit(Crit crit, const string& value) {
crits.push_back(crit);
values.push_back(value);
}
std::vector<Crit> crits;
std::vector<string> values;
void reset() {crits.clear(); values.clear();}
bool isNotNull() {return crits.size() != 0;}
};
/** Interface for a list of documents coming from some source.
The result list display data may come from different sources (ie:
history or Db query), and be post-processed (DocSeqSorted).
Additional functionality like filtering/sorting can either be
obtained by stacking DocSequence objects (ie: sorting history), or
by native capability (ex: docseqdb can sort and filter). The
implementation might be nicer by using more sophisticated c++ with
multiple inheritance of sort and filter virtual interfaces, but
the current one will have to do for now...
*/
class DocSequence {
public:
@ -83,6 +121,13 @@ class DocSequence {
terms.clear(); groups.clear(); gslks.clear(); return true;
}
virtual list<string> expand(Rcl::Doc &) {list<string> e; return e;}
/** Optional functionality. Yeah, not nice */
virtual bool canFilter() {return false;}
virtual bool setFiltSpec(DocSeqFiltSpec &) {return false;}
virtual bool canSort() {return false;}
virtual bool setSortSpec(DocSeqSortSpec &) {return false;}
private:
string m_title;
};

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.7 2008-09-29 08:59:20 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.8 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -22,10 +22,11 @@ static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.7 2008-09-29 08:59:20 dockes Exp
#include "docseqdb.h"
#include "rcldb.h"
#include "debuglog.h"
DocSequenceDb::DocSequenceDb(RefCntr<Rcl::Query> q, const string &t,
RefCntr<Rcl::SearchData> sdata)
: DocSequence(t), m_q(q), m_sdata(sdata), m_rescnt(-1)
: DocSequence(t), m_q(q), m_sdata(sdata), m_rescnt(-1), m_filt(false)
{
}
@ -37,12 +38,12 @@ bool DocSequenceDb::getTerms(vector<string>& terms,
vector<vector<string> >& groups,
vector<int>& gslks)
{
return m_sdata->getTerms(terms, groups, gslks);
return m_fsdata->getTerms(terms, groups, gslks);
}
string DocSequenceDb::getDescription()
{
return m_sdata->getDescription();
return m_fsdata->getDescription();
}
bool DocSequenceDb::getDoc(int num, Rcl::Doc &doc, string *sh)
@ -73,3 +74,39 @@ list<string> DocSequenceDb::expand(Rcl::Doc &doc)
return m_q->expand(doc);
}
bool DocSequenceDb::setFiltSpec(DocSeqFiltSpec &fs)
{
if (!fs.isNotNull()) {
m_fsdata = m_sdata;
m_filt = false;
return m_q->setQuery(m_sdata);
}
// We build a search spec by adding a filtering layer to the base one.
m_fsdata = RefCntr<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND));
Rcl::SearchDataClauseSub *cl =
new Rcl::SearchDataClauseSub(Rcl::SCLT_SUB, m_sdata);
m_fsdata->addClause(cl);
for (unsigned int i = 0; i < fs.crits.size(); i++) {
switch (fs.crits[i]) {
case DocSeqFiltSpec::DSFS_MIMETYPE:
m_fsdata->addFiletype(fs.values[i]);
}
}
m_filt = true;
return m_q->setQuery(m_fsdata);
}
// Need a way to access the translations for filtered ...
string DocSequenceDb::title()
{
LOGDEB(("DOcSequenceDb::title()\n"));
return m_filt ? DocSequence::title() + " (filtered)" : DocSequence::title();
}
// TBDone
bool DocSequenceDb::setSortSpec(DocSeqSortSpec &sortspec)
{
return true;
}

View File

@ -16,7 +16,7 @@
*/
#ifndef _DOCSEQDB_H_INCLUDED_
#define _DOCSEQDB_H_INCLUDED_
/* @(#$Id: docseqdb.h,v 1.5 2008-09-29 08:59:20 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: docseqdb.h,v 1.6 2008-09-29 11:33:55 dockes Exp $ (C) 2004 J.F.Dockes */
#include "docseq.h"
#include "refcntr.h"
@ -38,10 +38,17 @@ class DocSequenceDb : public DocSequence {
virtual string getAbstract(Rcl::Doc &doc);
virtual string getDescription();
virtual list<string> expand(Rcl::Doc &doc);
virtual bool canFilter() {return true;}
virtual bool setFiltSpec(DocSeqFiltSpec &filtspec);
virtual bool canSort() {return false;}
virtual bool setSortSpec(DocSeqSortSpec &sortspec);
virtual string title();
private:
RefCntr<Rcl::Query> m_q;
RefCntr<Rcl::SearchData> m_sdata;
RefCntr<Rcl::SearchData> m_fsdata; // Filtered
int m_rescnt;
bool m_filt;
};
#endif /* _DOCSEQDB_H_INCLUDED_ */

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: filtseq.cpp,v 1.2 2008-09-29 08:59:20 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: filtseq.cpp,v 1.3 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -47,6 +47,12 @@ DocSeqFiltered::DocSeqFiltered(RefCntr<DocSequence> iseq,
{
}
bool DocSeqFiltered::setFiltSpec(DocSeqFiltSpec &filtspec)
{
m_spec = filtspec;
m_dbindices.clear();
}
bool DocSeqFiltered::getDoc(int idx, Rcl::Doc &doc, string *)
{
LOGDEB1(("DocSeqFiltered: fetching %d\n", idx));

View File

@ -16,7 +16,7 @@
*/
#ifndef _FILTSEQ_H_INCLUDED_
#define _FILTSEQ_H_INCLUDED_
/* @(#$Id: filtseq.h,v 1.3 2008-09-29 08:59:20 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: filtseq.h,v 1.4 2008-09-29 11:33:55 dockes Exp $ (C) 2004 J.F.Dockes */
#include <vector>
#include <string>
@ -24,19 +24,6 @@
#include "refcntr.h"
#include "docseq.h"
class DocSeqFiltSpec {
public:
DocSeqFiltSpec() {}
enum Crit {DSFS_MIMETYPE};
void orCrit(Crit crit, const string& value) {
crits.push_back(crit);
values.push_back(value);
}
std::vector<Crit> crits;
std::vector<string> values;
void reset() {crits.clear(); values.clear();}
bool isNotNull() {return crits.size() != 0;}
};
/**
* A filtered sequence is created from another one by selecting entries
@ -47,6 +34,8 @@ class DocSeqFiltered : public DocSequence {
DocSeqFiltered(RefCntr<DocSequence> iseq, DocSeqFiltSpec &filtspec,
const std::string &t);
virtual ~DocSeqFiltered() {}
virtual bool canFilter() {return true;}
virtual bool setFiltSpec(DocSeqFiltSpec &filtspec);
virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0);
virtual int getResCnt() {return m_seq->getResCnt();}
virtual string getAbstract(Rcl::Doc& doc) {

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: recollq.cpp,v 1.18 2008-09-29 08:59:20 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: recollq.cpp,v 1.19 2008-09-29 11:33:55 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -221,13 +221,14 @@ int recollq(RclConfig **cfp, int argc, char **argv)
cerr << "Query string interpretation failed: " << reason << endl;
return 1;
}
sd->setStemlang("english");
RefCntr<Rcl::SearchData> rq(sd);
Rcl::Query query(&rcldb);
if (op_flags & OPT_S) {
query.setSortBy(sortfield, (op_flags & OPT_D) ? false : true);
}
query.setQuery(rq, Rcl::Query::QO_STEM);
query.setQuery(rq);
int cnt = query.getResCnt();
if (!(op_flags & OPT_b)) {
cout << "Recoll query: " << rq->getDescription() << endl;

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.13 2008-09-29 08:59:20 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.14 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -53,20 +53,6 @@ public:
return 0;
}
break;
case DocSeqSortSpec::RCLFLD_URL:
LOGDEB1((" URL\n"));
if (ss.dirs[i] ? x->url > y->url : x->url < y->url)
return 1;
else if (x->url != y->url)
return 0;
break;
case DocSeqSortSpec::RCLFLD_IPATH:
LOGDEB1((" IPATH\n"));
if (ss.dirs[i] ? x->ipath > y->ipath : x->ipath < y->ipath)
return 1;
else if (x->ipath != y->ipath)
return 0;
break;
case DocSeqSortSpec::RCLFLD_MIMETYPE:
LOGDEB1((" MIMETYPE\n"));
if (ss.dirs[i] ? x->mimetype > y->mimetype :
@ -85,13 +71,18 @@ public:
DocSeqSorted::DocSeqSorted(RefCntr<DocSequence> iseq, DocSeqSortSpec &sortspec,
const std::string &t)
: DocSequence(t), m_seq(iseq)
{
setSortSpec(sortspec);
}
bool DocSeqSorted::setSortSpec(DocSeqSortSpec &sortspec)
{
m_spec = sortspec;
LOGDEB(("DocSeqSorted:: count %d\n", m_spec.sortdepth));
m_docs.resize(m_spec.sortdepth);
int i;
for (i = 0; i < m_spec.sortdepth; i++) {
if (!iseq->getDoc(i, m_docs[i])) {
if (!m_seq->getDoc(i, m_docs[i])) {
LOGERR(("DocSeqSorted: getDoc failed for doc %d\n", i));
break;
}
@ -105,6 +96,7 @@ DocSeqSorted::DocSeqSorted(RefCntr<DocSequence> iseq, DocSeqSortSpec &sortspec,
CompareDocs cmp(sortspec);
sort(m_docsp.begin(), m_docsp.end(), cmp);
return true;
}
bool DocSeqSorted::getDoc(int num, Rcl::Doc &doc, string *)

View File

@ -16,7 +16,7 @@
*/
#ifndef _SORTSEQ_H_INCLUDED_
#define _SORTSEQ_H_INCLUDED_
/* @(#$Id: sortseq.h,v 1.12 2008-09-29 08:59:20 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: sortseq.h,v 1.13 2008-09-29 11:33:55 dockes Exp $ (C) 2004 J.F.Dockes */
#include <vector>
#include <string>
@ -24,21 +24,6 @@
#include "refcntr.h"
#include "docseq.h"
class DocSeqSortSpec {
public:
DocSeqSortSpec() : sortdepth(0) {}
enum Field {RCLFLD_URL, RCLFLD_IPATH, RCLFLD_MIMETYPE, RCLFLD_MTIME};
void addCrit(Field fld, bool desc = false) {
crits.push_back(fld);
dirs.push_back(desc);
}
bool isNotNull() {return sortdepth > 0;}
int sortdepth; // We only re-sort the first sortdepth most relevant docs
std::vector<Field> crits;
std::vector<bool> dirs;
};
/**
* A sorted sequence is created from the first N documents of another one,
* and sorts them according to the given criteria.
@ -48,6 +33,8 @@ class DocSeqSorted : public DocSequence {
DocSeqSorted(RefCntr<DocSequence> iseq, DocSeqSortSpec &sortspec,
const std::string &t);
virtual ~DocSeqSorted() {}
virtual bool canSort() {return true;}
virtual bool setSortSpec(DocSeqSortSpec &sortspec);
virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0);
virtual int getResCnt() {return m_spec.sortdepth;}
virtual string getAbstract(Rcl::Doc& doc) {

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.8 2008-09-29 08:59:20 dockes Exp $ (C) 2008 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.9 2008-09-29 11:33:55 dockes Exp $ (C) 2008 J.F.Dockes";
#endif
#include <stdlib.h>
@ -124,8 +124,7 @@ void Query::setSortBy(const string& fld, bool ascending) {
#define ISNULL(X) !(X)
// Prepare query out of user search data
bool Query::setQuery(RefCntr<SearchData> sdata, int opts,
const string& stemlang)
bool Query::setQuery(RefCntr<SearchData> sdata)
{
LOGDEB(("Query::setQuery:\n"));
@ -136,7 +135,6 @@ bool Query::setQuery(RefCntr<SearchData> sdata, int opts,
m_reason.erase();
m_filterTopDir = sdata->getTopdir();
m_qOpts = opts;
m_nq->clear();
if (!m_filterTopDir.empty()) {
@ -149,8 +147,7 @@ bool Query::setQuery(RefCntr<SearchData> sdata, int opts,
}
Xapian::Query xq;
if (!sdata->toNativeQuery(*m_db, &xq, (opts & QO_STEM) ?
stemlang : string())) {
if (!sdata->toNativeQuery(*m_db, &xq)) {
m_reason += sdata->getReason();
return false;
}

View File

@ -1,6 +1,6 @@
#ifndef _rclquery_h_included_
#define _rclquery_h_included_
/* @(#$Id: rclquery.h,v 1.5 2008-09-29 08:59:20 dockes Exp $ (C) 2008 J.F.Dockes */
/* @(#$Id: rclquery.h,v 1.6 2008-09-29 11:33:55 dockes Exp $ (C) 2008 J.F.Dockes */
/*
* 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
@ -45,8 +45,6 @@ class Doc;
*/
class Query {
public:
enum QueryOpts {QO_NONE=0, QO_STEM = 1};
/** The constructor only allocates memory */
Query(Db *db);
~Query();
@ -63,8 +61,7 @@ class Query {
* be called repeatedly on the same object which gets reinitialized each
* time.
*/
bool setQuery(RefCntr<SearchData> q, int opts = QO_NONE,
const string& stemlang = "english");
bool setQuery(RefCntr<SearchData> q);
/** Get results count for current query */
int getResCnt();
@ -93,7 +90,6 @@ private:
string m_reason; // Error explanation
Db *m_db;
void *m_sorter;
unsigned int m_qOpts;
string m_sortField;
bool m_sortAscending;
/* Copyconst and assignement private and forbidden */

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.24 2008-09-29 06:58:25 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.25 2008-09-29 11:33:55 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -43,7 +43,7 @@ namespace Rcl {
typedef vector<SearchDataClause *>::iterator qlist_it_t;
typedef vector<SearchDataClause *>::const_iterator qlist_cit_t;
bool SearchData::toNativeQuery(Rcl::Db &db, void *d, const string& stemlang)
bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
{
Xapian::Query xq;
m_reason.erase();
@ -74,7 +74,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d, const string& stemlang)
// Xapian query tree
for (qlist_it_t it = m_query.begin(); it != m_query.end(); it++) {
Xapian::Query nq;
if (!(*it)->toNativeQuery(db, &nq, stemlang)) {
if (!(*it)->toNativeQuery(db, &nq, m_stemlang)) {
LOGERR(("SearchData::toNativeQuery: failed\n"));
m_reason = (*it)->getReason();
return false;
@ -631,10 +631,9 @@ bool SearchDataClauseDist::toNativeQuery(Rcl::Db &db, void *p,
}
// Translate subquery
bool SearchDataClauseSub::toNativeQuery(Rcl::Db &db, void *p,
const string& stemlang)
bool SearchDataClauseSub::toNativeQuery(Rcl::Db &db, void *p, const string&)
{
return m_sub->toNativeQuery(db, p, stemlang);
return m_sub->toNativeQuery(db, p);
}
} // Namespace Rcl

View File

@ -16,7 +16,7 @@
*/
#ifndef _SEARCHDATA_H_INCLUDED_
#define _SEARCHDATA_H_INCLUDED_
/* @(#$Id: searchdata.h,v 1.19 2008-09-29 06:58:25 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: searchdata.h,v 1.20 2008-09-29 11:33:55 dockes Exp $ (C) 2004 J.F.Dockes */
/**
* Structures to hold data coming almost directly from the gui
@ -83,7 +83,7 @@ public:
bool haveWildCards() {return m_haveWildCards;}
/** Translate to Xapian query. rcldb knows about the void* */
bool toNativeQuery(Rcl::Db &db, void *, const string& stemlang);
bool toNativeQuery(Rcl::Db &db, void *);
/** We become the owner of cl and will delete it */
bool addClause(SearchDataClause *cl);
@ -109,7 +109,7 @@ public:
void setTopdir(const string& t) {m_topdir = t;}
/** Add file type for filtering results */
void addFiletype(const string& ft) {m_filetypes.push_back(ft);}
void setStemlang(const string& lang = "english") {m_stemlang = lang;}
private:
SClType m_tp; // Only SCLT_AND or SCLT_OR here
vector<SearchDataClause*> m_query;
@ -120,6 +120,7 @@ private:
string m_description;
string m_reason;
bool m_haveWildCards;
string m_stemlang;
/* Copyconst and assignment private and forbidden */
SearchData(const SearchData &) {}
SearchData& operator=(const SearchData&) {return *this;};