indents etc.
This commit is contained in:
parent
d207d4f1c5
commit
9abaf84be6
@ -81,8 +81,7 @@ bool DocSource::buildStack()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_fspec.isNotNull()) {
|
if (m_fspec.isNotNull()) {
|
||||||
m_seq =
|
m_seq = std::shared_ptr<DocSequence>(new DocSeqFiltered(m_config, m_seq, m_fspec));
|
||||||
std::shared_ptr<DocSequence>(new DocSeqFiltered(m_config, m_seq, m_fspec));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,14 +31,7 @@ using std::list;
|
|||||||
DocSequenceDb::DocSequenceDb(std::shared_ptr<Rcl::Db> db,
|
DocSequenceDb::DocSequenceDb(std::shared_ptr<Rcl::Db> db,
|
||||||
std::shared_ptr<Rcl::Query> q, const string &t,
|
std::shared_ptr<Rcl::Query> q, const string &t,
|
||||||
std::shared_ptr<Rcl::SearchData> sdata)
|
std::shared_ptr<Rcl::SearchData> sdata)
|
||||||
: DocSequence(t), m_db(db), m_q(q), m_sdata(sdata), m_fsdata(sdata),
|
: DocSequence(t), m_db(db), m_q(q), m_sdata(sdata), m_fsdata(sdata)
|
||||||
m_rescnt(-1),
|
|
||||||
m_queryBuildAbstract(true),
|
|
||||||
m_queryReplaceAbstract(false),
|
|
||||||
m_isFiltered(false),
|
|
||||||
m_isSorted(false),
|
|
||||||
m_needSetQuery(false),
|
|
||||||
m_lastSQStatus(true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,8 +154,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
|||||||
std::unique_lock<std::mutex> locker(o_dblock);
|
std::unique_lock<std::mutex> locker(o_dblock);
|
||||||
if (fs.isNotNull()) {
|
if (fs.isNotNull()) {
|
||||||
// We build a search spec by adding a filtering layer to the base one.
|
// We build a search spec by adding a filtering layer to the base one.
|
||||||
m_fsdata = std::make_shared<Rcl::SearchData>(
|
m_fsdata = std::make_shared<Rcl::SearchData>(Rcl::SCLT_AND, m_sdata->getStemLang());
|
||||||
Rcl::SCLT_AND, m_sdata->getStemLang());
|
|
||||||
Rcl::SearchDataClauseSub *cl = new Rcl::SearchDataClauseSub(m_sdata);
|
Rcl::SearchDataClauseSub *cl = new Rcl::SearchDataClauseSub(m_sdata);
|
||||||
m_fsdata->addClause(cl);
|
m_fsdata->addClause(cl);
|
||||||
|
|
||||||
@ -171,18 +163,15 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
|||||||
case DocSeqFiltSpec::DSFS_MIMETYPE:
|
case DocSeqFiltSpec::DSFS_MIMETYPE:
|
||||||
m_fsdata->addFiletype(fs.values[i]);
|
m_fsdata->addFiletype(fs.values[i]);
|
||||||
break;
|
break;
|
||||||
case DocSeqFiltSpec::DSFS_QLANG:
|
case DocSeqFiltSpec::DSFS_QLANG: {
|
||||||
{
|
|
||||||
if (!m_q)
|
if (!m_q)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
auto sd = wasaStringToRcl(m_q->whatDb()->getConf(),
|
auto sd = wasaStringToRcl(
|
||||||
m_sdata->getStemLang(),
|
m_q->whatDb()->getConf(), m_sdata->getStemLang(), fs.values[i], reason);
|
||||||
fs.values[i], reason);
|
|
||||||
if (sd) {
|
if (sd) {
|
||||||
Rcl::SearchDataClauseSub *cl1 =
|
Rcl::SearchDataClauseSub *cl1 = new Rcl::SearchDataClauseSub(sd);
|
||||||
new Rcl::SearchDataClauseSub(sd);
|
|
||||||
m_fsdata->addClause(cl1);
|
m_fsdata->addClause(cl1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,8 +215,7 @@ bool DocSequenceDb::setQuery()
|
|||||||
m_lastSQStatus = m_q->setQuery(m_fsdata);
|
m_lastSQStatus = m_q->setQuery(m_fsdata);
|
||||||
if (!m_lastSQStatus) {
|
if (!m_lastSQStatus) {
|
||||||
m_reason = m_q->getReason();
|
m_reason = m_q->getReason();
|
||||||
LOGERR("DocSequenceDb::setQuery: rclquery::setQuery failed: " <<
|
LOGERR("DocSequenceDb::setQuery: rclquery::setQuery failed: " << m_reason << "\n");
|
||||||
m_reason << "\n");
|
|
||||||
}
|
}
|
||||||
return m_lastSQStatus;
|
return m_lastSQStatus;
|
||||||
}
|
}
|
||||||
@ -241,4 +229,3 @@ bool DocSequenceDb::docDups(const Rcl::Doc& doc, std::vector<Rcl::Doc>& dups)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2004 J.F.Dockes
|
/* Copyright (C) 2004-2021 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
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@ -68,13 +68,13 @@ private:
|
|||||||
std::shared_ptr<Rcl::Query> m_q;
|
std::shared_ptr<Rcl::Query> m_q;
|
||||||
std::shared_ptr<Rcl::SearchData> m_sdata;
|
std::shared_ptr<Rcl::SearchData> m_sdata;
|
||||||
std::shared_ptr<Rcl::SearchData> m_fsdata; // Filtered
|
std::shared_ptr<Rcl::SearchData> m_fsdata; // Filtered
|
||||||
int m_rescnt;
|
int m_rescnt{-1};
|
||||||
bool m_queryBuildAbstract;
|
bool m_queryBuildAbstract{true};
|
||||||
bool m_queryReplaceAbstract;
|
bool m_queryReplaceAbstract{false};
|
||||||
bool m_isFiltered;
|
bool m_isFiltered{false};
|
||||||
bool m_isSorted;
|
bool m_isSorted{false};
|
||||||
bool m_needSetQuery; // search data changed, need to reapply before fetch
|
bool m_needSetQuery{false}; // search data changed, need to reapply before fetch
|
||||||
bool m_lastSQStatus;
|
bool m_lastSQStatus{true};
|
||||||
bool setQuery();
|
bool setQuery();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -29,11 +29,13 @@ class RclConfig;
|
|||||||
/**
|
/**
|
||||||
* A filtered sequence is created from another one by selecting entries
|
* A filtered sequence is created from another one by selecting entries
|
||||||
* according to the given criteria.
|
* according to the given criteria.
|
||||||
|
* Note that this class can only filter on mime type (or rclcatg) at the moment,
|
||||||
|
* and is only used for history. Normal query filtering is performed by adding a
|
||||||
|
* clause to the Xapian query.
|
||||||
*/
|
*/
|
||||||
class DocSeqFiltered : public DocSeqModifier {
|
class DocSeqFiltered : public DocSeqModifier {
|
||||||
public:
|
public:
|
||||||
DocSeqFiltered(RclConfig *conf, std::shared_ptr<DocSequence> iseq,
|
DocSeqFiltered(RclConfig *conf, std::shared_ptr<DocSequence> iseq, DocSeqFiltSpec &filtspec);
|
||||||
DocSeqFiltSpec &filtspec);
|
|
||||||
virtual ~DocSeqFiltered() {}
|
virtual ~DocSeqFiltered() {}
|
||||||
virtual bool canFilter() {return true;}
|
virtual bool canFilter() {return true;}
|
||||||
virtual bool setFiltSpec(const DocSeqFiltSpec &filtspec);
|
virtual bool setFiltSpec(const DocSeqFiltSpec &filtspec);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user