got rid of accesses to global config through getMainConfig()
This commit is contained in:
parent
bac0c1eeb9
commit
e1a20aa810
@ -183,8 +183,12 @@ RclConfig::RclConfig(const string *argcnf)
|
|||||||
|
|
||||||
bool RclConfig::updateMainConfig()
|
bool RclConfig::updateMainConfig()
|
||||||
{
|
{
|
||||||
m_conf = new ConfStack<ConfTree>("recoll.conf", m_cdirs, true);
|
LOGDEB(("RclConfig::updateMainConfig\n"));
|
||||||
if (m_conf == 0 || !m_conf->ok()) {
|
ConfStack<ConfTree> *newconf =
|
||||||
|
new ConfStack<ConfTree>("recoll.conf", m_cdirs, true);
|
||||||
|
if (newconf == 0 || !newconf->ok()) {
|
||||||
|
if (m_conf)
|
||||||
|
return false;
|
||||||
string where;
|
string where;
|
||||||
stringsToString(m_cdirs, where);
|
stringsToString(m_cdirs, where);
|
||||||
m_reason = string("No/bad main configuration file in: ") + where;
|
m_reason = string("No/bad main configuration file in: ") + where;
|
||||||
@ -211,6 +215,8 @@ bool RclConfig::updateMainConfig()
|
|||||||
TextSplit::noNumbers();
|
TextSplit::noNumbers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete m_conf;
|
||||||
|
m_conf = newconf;
|
||||||
m_skpnstate.init(this, m_conf, "skippedNames");
|
m_skpnstate.init(this, m_conf, "skippedNames");
|
||||||
m_rmtstate.init(this, m_conf, "indexedmimetypes");
|
m_rmtstate.init(this, m_conf, "indexedmimetypes");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -64,12 +64,6 @@ class RclConfig {
|
|||||||
// argcnf
|
// argcnf
|
||||||
RclConfig(const string *argcnf = 0);
|
RclConfig(const string *argcnf = 0);
|
||||||
|
|
||||||
// Main programs must implement this, it avoids having to carry
|
|
||||||
// the configuration parameter everywhere. Places where several
|
|
||||||
// RclConfig instances might be needed will take care of
|
|
||||||
// themselves.
|
|
||||||
static RclConfig* getMainConfig();
|
|
||||||
|
|
||||||
// Return a writable clone of the main config. This belongs to the
|
// Return a writable clone of the main config. This belongs to the
|
||||||
// caller (must delete it when done)
|
// caller (must delete it when done)
|
||||||
ConfNull *cloneMainConfig();
|
ConfNull *cloneMainConfig();
|
||||||
|
|||||||
@ -201,10 +201,6 @@ Usage(FILE *where = stderr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static RclConfig *config;
|
static RclConfig *config;
|
||||||
RclConfig *RclConfig::getMainConfig()
|
|
||||||
{
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lockorexit(Pidfile *pidfile)
|
void lockorexit(Pidfile *pidfile)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1053,10 +1053,6 @@ static int op_flags;
|
|||||||
#define OPT_q 0x1
|
#define OPT_q 0x1
|
||||||
|
|
||||||
RclConfig *config;
|
RclConfig *config;
|
||||||
RclConfig *RclConfig::getMainConfig()
|
|
||||||
{
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
thisprog = argv[0];
|
thisprog = argv[0];
|
||||||
|
|||||||
@ -78,10 +78,7 @@ bool MimeHandlerExec::next_document()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int filtermaxseconds = 900;
|
int filtermaxseconds = 900;
|
||||||
RclConfig *conf = RclConfig::getMainConfig();
|
m_config->getConfParam("filtermaxseconds", &filtermaxseconds);
|
||||||
if (conf) {
|
|
||||||
conf->getConfParam("filtermaxseconds", &filtermaxseconds);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command name
|
// Command name
|
||||||
string cmd = params.front();
|
string cmd = params.front();
|
||||||
|
|||||||
@ -57,7 +57,8 @@ class MimeHandlerExec : public RecollFilter {
|
|||||||
bool missingHelper;
|
bool missingHelper;
|
||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
MimeHandlerExec(const string& mt) : RecollFilter(mt), missingHelper(false)
|
MimeHandlerExec(RclConfig *cnf, const string& mt)
|
||||||
|
: RecollFilter(cnf, mt), missingHelper(false)
|
||||||
{}
|
{}
|
||||||
virtual ~MimeHandlerExec() {}
|
virtual ~MimeHandlerExec() {}
|
||||||
virtual bool set_document_file(const string &file_path) {
|
virtual bool set_document_file(const string &file_path) {
|
||||||
|
|||||||
@ -251,7 +251,7 @@ bool MimeHandlerExecMultiple::next_document()
|
|||||||
if (!ipath.empty()) {
|
if (!ipath.empty()) {
|
||||||
m_metaData["ipath"] = ipath;
|
m_metaData["ipath"] = ipath;
|
||||||
if (mtype.empty()) {
|
if (mtype.empty()) {
|
||||||
mtype = mimetype(ipath, 0, RclConfig::getMainConfig(), false);
|
mtype = mimetype(ipath, 0, m_config, false);
|
||||||
if (mtype.empty()) {
|
if (mtype.empty()) {
|
||||||
// mimetype() won't call idFile when there is no file. Do it
|
// mimetype() won't call idFile when there is no file. Do it
|
||||||
mtype = idFileMem(m_metaData["content"]);
|
mtype = idFileMem(m_metaData["content"]);
|
||||||
|
|||||||
@ -91,8 +91,8 @@ class MimeHandlerExecMultiple : public MimeHandlerExec {
|
|||||||
/////// End un-cleared stuff.
|
/////// End un-cleared stuff.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MimeHandlerExecMultiple(const string& mt)
|
MimeHandlerExecMultiple(RclConfig *cnf, const string& mt)
|
||||||
: MimeHandlerExec(mt)
|
: MimeHandlerExec(cnf, mt)
|
||||||
{}
|
{}
|
||||||
// No resources to clean up, the ExecCmd destructor does it.
|
// No resources to clean up, the ExecCmd destructor does it.
|
||||||
virtual ~MimeHandlerExecMultiple() {}
|
virtual ~MimeHandlerExecMultiple() {}
|
||||||
|
|||||||
@ -27,7 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
class MimeHandlerHtml : public RecollFilter {
|
class MimeHandlerHtml : public RecollFilter {
|
||||||
public:
|
public:
|
||||||
MimeHandlerHtml(const string& mt) : RecollFilter(mt) {}
|
MimeHandlerHtml(RclConfig *cnf, const string& mt)
|
||||||
|
: RecollFilter(cnf, mt) {}
|
||||||
virtual ~MimeHandlerHtml() {}
|
virtual ~MimeHandlerHtml() {}
|
||||||
virtual bool set_document_file(const string &file_path);
|
virtual bool set_document_file(const string &file_path);
|
||||||
virtual bool set_document_string(const string &data);
|
virtual bool set_document_string(const string &data);
|
||||||
|
|||||||
@ -55,19 +55,18 @@ static const string cstr_title = "title";
|
|||||||
static const string cstr_msgid = "msgid";
|
static const string cstr_msgid = "msgid";
|
||||||
static const string cstr_abstract = "abstract";
|
static const string cstr_abstract = "abstract";
|
||||||
|
|
||||||
MimeHandlerMail::MimeHandlerMail(const string &mt)
|
MimeHandlerMail::MimeHandlerMail(RclConfig *cnf, const string &mt)
|
||||||
: RecollFilter(mt), m_bincdoc(0), m_fd(-1), m_stream(0), m_idx(-1)
|
: RecollFilter(cnf, mt), m_bincdoc(0), m_fd(-1), m_stream(0), m_idx(-1)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Look for additional headers to be processed as per config:
|
// Look for additional headers to be processed as per config:
|
||||||
list<string> hdrnames =
|
list<string> hdrnames =
|
||||||
RclConfig::getMainConfig()->getFieldSectNames("mail");
|
m_config->getFieldSectNames("mail");
|
||||||
if (hdrnames.empty())
|
if (hdrnames.empty())
|
||||||
return;
|
return;
|
||||||
for (list<string>::const_iterator it = hdrnames.begin();
|
for (list<string>::const_iterator it = hdrnames.begin();
|
||||||
it != hdrnames.end(); it++) {
|
it != hdrnames.end(); it++) {
|
||||||
(void)RclConfig::getMainConfig()->
|
(void)m_config->getFieldConfParam(*it, "mail", m_addProcdHdrs[*it]);
|
||||||
getFieldConfParam(*it, "mail", m_addProcdHdrs[*it]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +281,7 @@ bool MimeHandlerMail::processAttach()
|
|||||||
if (m_metaData[cstr_mimetype] == "application/octet-stream" &&
|
if (m_metaData[cstr_mimetype] == "application/octet-stream" &&
|
||||||
!m_metaData["filename"].empty()) {
|
!m_metaData["filename"].empty()) {
|
||||||
string mt = mimetype(m_metaData["filename"], 0,
|
string mt = mimetype(m_metaData["filename"], 0,
|
||||||
RclConfig::getMainConfig(), false);
|
m_config, false);
|
||||||
if (!mt.empty())
|
if (!mt.empty())
|
||||||
m_metaData[cstr_mimetype] = mt;
|
m_metaData[cstr_mimetype] = mt;
|
||||||
}
|
}
|
||||||
@ -532,7 +531,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
|
|||||||
!stringlowercmp("x-user-defined", charset) ||
|
!stringlowercmp("x-user-defined", charset) ||
|
||||||
!stringlowercmp("x-unknown", charset) ||
|
!stringlowercmp("x-unknown", charset) ||
|
||||||
!stringlowercmp("unknown", charset) ) {
|
!stringlowercmp("unknown", charset) ) {
|
||||||
RclConfig::getMainConfig()->getConfParam("maildefcharset", charset);
|
m_config->getConfParam("maildefcharset", charset);
|
||||||
if (charset.empty())
|
if (charset.empty())
|
||||||
charset = "iso-8859-1";
|
charset = "iso-8859-1";
|
||||||
}
|
}
|
||||||
@ -598,7 +597,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
|
|||||||
string utf8;
|
string utf8;
|
||||||
const string *putf8 = 0;
|
const string *putf8 = 0;
|
||||||
if (!stringlowercmp("text/html", content_type.value)) {
|
if (!stringlowercmp("text/html", content_type.value)) {
|
||||||
MimeHandlerHtml mh("text/html");
|
MimeHandlerHtml mh(m_config, "text/html");
|
||||||
mh.set_property(Dijon::Filter::OPERATING_MODE,
|
mh.set_property(Dijon::Filter::OPERATING_MODE,
|
||||||
m_forPreview ? "view" : "index");
|
m_forPreview ? "view" : "index");
|
||||||
mh.set_property(Dijon::Filter::DEFAULT_CHARSET, charset);
|
mh.set_property(Dijon::Filter::DEFAULT_CHARSET, charset);
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class MHMailAttach;
|
|||||||
*/
|
*/
|
||||||
class MimeHandlerMail : public RecollFilter {
|
class MimeHandlerMail : public RecollFilter {
|
||||||
public:
|
public:
|
||||||
MimeHandlerMail(const string &mt);
|
MimeHandlerMail(RclConfig *cnf, const string &mt);
|
||||||
virtual ~MimeHandlerMail();
|
virtual ~MimeHandlerMail();
|
||||||
virtual bool set_document_file(const string& file_path);
|
virtual bool set_document_file(const string& file_path);
|
||||||
virtual bool set_document_string(const string& data);
|
virtual bool set_document_string(const string& data);
|
||||||
|
|||||||
@ -79,11 +79,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
~MboxCache() {}
|
~MboxCache() {}
|
||||||
mbhoff_type get_offset(const string& udi, int msgnum)
|
mbhoff_type get_offset(RclConfig *config, const string& udi, int msgnum)
|
||||||
{
|
{
|
||||||
LOGDEB0(("MboxCache::get_offsets: udi [%s] msgnum %d\n", udi.c_str(),
|
LOGDEB0(("MboxCache::get_offsets: udi [%s] msgnum %d\n", udi.c_str(),
|
||||||
msgnum));
|
msgnum));
|
||||||
if (!ok()) {
|
if (!ok(config)) {
|
||||||
LOGDEB0(("MboxCache::get_offsets: init failed\n"));
|
LOGDEB0(("MboxCache::get_offsets: init failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -125,11 +125,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save array of offsets for a given file, designated by Udi
|
// Save array of offsets for a given file, designated by Udi
|
||||||
void put_offsets(const string& udi, mbhoff_type fsize,
|
void put_offsets(RclConfig *config, const string& udi, mbhoff_type fsize,
|
||||||
vector<mbhoff_type>& offs)
|
vector<mbhoff_type>& offs)
|
||||||
{
|
{
|
||||||
LOGDEB0(("MboxCache::put_offsets: %u offsets\n", offs.size()));
|
LOGDEB0(("MboxCache::put_offsets: %u offsets\n", offs.size()));
|
||||||
if (!ok() || !maybemakedir())
|
if (!ok(config) || !maybemakedir())
|
||||||
return;
|
return;
|
||||||
if (fsize < m_minfsize)
|
if (fsize < m_minfsize)
|
||||||
return;
|
return;
|
||||||
@ -161,13 +161,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check state, possibly initialize
|
// Check state, possibly initialize
|
||||||
bool ok() {
|
bool ok(RclConfig *config) {
|
||||||
if (m_minfsize == -1)
|
if (m_minfsize == -1)
|
||||||
return false;
|
return false;
|
||||||
if (!m_ok) {
|
if (!m_ok) {
|
||||||
RclConfig *config = RclConfig::getMainConfig();
|
|
||||||
if (config == 0)
|
|
||||||
return false;
|
|
||||||
int minmbs = 5;
|
int minmbs = 5;
|
||||||
config->getConfParam("mboxcacheminmbs", &minmbs);
|
config->getConfParam("mboxcacheminmbs", &minmbs);
|
||||||
if (minmbs < 0) {
|
if (minmbs < 0) {
|
||||||
@ -269,9 +266,8 @@ bool MimeHandlerMbox::set_document_file(const string &fn)
|
|||||||
m_quirks = 0;
|
m_quirks = 0;
|
||||||
|
|
||||||
// Check for location-based quirks:
|
// Check for location-based quirks:
|
||||||
RclConfig *config = RclConfig::getMainConfig();
|
|
||||||
string quirks;
|
string quirks;
|
||||||
if (config && config->getConfParam(keyquirks, quirks)) {
|
if (m_config && m_config->getConfParam(keyquirks, quirks)) {
|
||||||
if (quirks == "tbird") {
|
if (quirks == "tbird") {
|
||||||
LOGDEB(("MimeHandlerMbox: setting quirks TBIRD\n"));
|
LOGDEB(("MimeHandlerMbox: setting quirks TBIRD\n"));
|
||||||
m_quirks |= MBOXQUIRK_TBIRD;
|
m_quirks |= MBOXQUIRK_TBIRD;
|
||||||
@ -402,7 +398,7 @@ bool MimeHandlerMbox::next_document()
|
|||||||
LOGDEB0(("MimeHandlerMbox::next_doc: mtarg %d m_udi[%s]\n",
|
LOGDEB0(("MimeHandlerMbox::next_doc: mtarg %d m_udi[%s]\n",
|
||||||
mtarg, m_udi.c_str()));
|
mtarg, m_udi.c_str()));
|
||||||
if (!m_udi.empty() &&
|
if (!m_udi.empty() &&
|
||||||
(off = mcache.get_offset(m_udi, mtarg)) >= 0 &&
|
(off = mcache.get_offset(m_config, m_udi, mtarg)) >= 0 &&
|
||||||
fseeko(fp, (off_t)off, SEEK_SET) >= 0 &&
|
fseeko(fp, (off_t)off, SEEK_SET) >= 0 &&
|
||||||
fgets(line, LL, fp) &&
|
fgets(line, LL, fp) &&
|
||||||
(!regexec(&fromregex, line, 0, 0, 0) ||
|
(!regexec(&fromregex, line, 0, 0, 0) ||
|
||||||
@ -485,7 +481,7 @@ bool MimeHandlerMbox::next_document()
|
|||||||
LOGDEB2(("MimeHandlerMbox::next: eof hit\n"));
|
LOGDEB2(("MimeHandlerMbox::next: eof hit\n"));
|
||||||
m_havedoc = false;
|
m_havedoc = false;
|
||||||
if (!m_udi.empty()) {
|
if (!m_udi.empty()) {
|
||||||
mcache.put_offsets(m_udi, m_fsize, m_offsets);
|
mcache.put_offsets(m_config, m_udi, m_fsize, m_offsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return msgtxt.empty() ? false : true;
|
return msgtxt.empty() ? false : true;
|
||||||
@ -521,10 +517,6 @@ Usage(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
static RclConfig *config;
|
static RclConfig *config;
|
||||||
RclConfig *RclConfig::getMainConfig()
|
|
||||||
{
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
static int op_flags;
|
static int op_flags;
|
||||||
#define OPT_MOINS 0x1
|
#define OPT_MOINS 0x1
|
||||||
#define OPT_m 0x2
|
#define OPT_m 0x2
|
||||||
|
|||||||
@ -32,8 +32,9 @@ using std::vector;
|
|||||||
*/
|
*/
|
||||||
class MimeHandlerMbox : public RecollFilter {
|
class MimeHandlerMbox : public RecollFilter {
|
||||||
public:
|
public:
|
||||||
MimeHandlerMbox(const string& mime)
|
MimeHandlerMbox(RclConfig *cnf, const string& mime)
|
||||||
: RecollFilter(mime), m_vfp(0), m_msgnum(0), m_lineno(0), m_fsize(0)
|
: RecollFilter(cnf, mime), m_vfp(0), m_msgnum(0),
|
||||||
|
m_lineno(0), m_fsize(0)
|
||||||
{}
|
{}
|
||||||
virtual ~MimeHandlerMbox();
|
virtual ~MimeHandlerMbox();
|
||||||
virtual bool set_document_file(const string &file_path);
|
virtual bool set_document_file(const string &file_path);
|
||||||
|
|||||||
@ -59,13 +59,13 @@ bool MimeHandlerText::set_document_file(const string &fn)
|
|||||||
|
|
||||||
// Max file size parameter: texts over this size are not indexed
|
// Max file size parameter: texts over this size are not indexed
|
||||||
int maxmbs = 20;
|
int maxmbs = 20;
|
||||||
RclConfig::getMainConfig()->getConfParam("textfilemaxmbs", &maxmbs);
|
m_config->getConfParam("textfilemaxmbs", &maxmbs);
|
||||||
|
|
||||||
if (maxmbs == -1 || st.st_size / MB <= maxmbs) {
|
if (maxmbs == -1 || st.st_size / MB <= maxmbs) {
|
||||||
// Text file page size: if set, we split text files into
|
// Text file page size: if set, we split text files into
|
||||||
// multiple documents
|
// multiple documents
|
||||||
int ps = 1000;
|
int ps = 1000;
|
||||||
RclConfig::getMainConfig()->getConfParam("textfilepagekbs", &ps);
|
m_config->getConfParam("textfilepagekbs", &ps);
|
||||||
if (ps != -1) {
|
if (ps != -1) {
|
||||||
ps *= KB;
|
ps *= KB;
|
||||||
m_paging = true;
|
m_paging = true;
|
||||||
|
|||||||
@ -31,8 +31,8 @@ using std::string;
|
|||||||
*/
|
*/
|
||||||
class MimeHandlerText : public RecollFilter {
|
class MimeHandlerText : public RecollFilter {
|
||||||
public:
|
public:
|
||||||
MimeHandlerText(const string& mt)
|
MimeHandlerText(RclConfig *cnf, const string& mt)
|
||||||
: RecollFilter(mt), m_paging(false), m_offs(0) {}
|
: RecollFilter(cnf, mt), m_paging(false), m_offs(0) {}
|
||||||
virtual ~MimeHandlerText() {}
|
virtual ~MimeHandlerText() {}
|
||||||
virtual bool set_document_file(const string &file_path);
|
virtual bool set_document_file(const string &file_path);
|
||||||
virtual bool set_document_string(const string&);
|
virtual bool set_document_string(const string&);
|
||||||
|
|||||||
@ -28,7 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
class MimeHandlerUnknown : public RecollFilter {
|
class MimeHandlerUnknown : public RecollFilter {
|
||||||
public:
|
public:
|
||||||
MimeHandlerUnknown(const string& mt) : RecollFilter(mt) {}
|
MimeHandlerUnknown(RclConfig *cnf, const string& mt)
|
||||||
|
: RecollFilter(cnf, mt) {}
|
||||||
virtual ~MimeHandlerUnknown() {}
|
virtual ~MimeHandlerUnknown() {}
|
||||||
virtual bool set_document_string(const string& fn) {
|
virtual bool set_document_string(const string& fn) {
|
||||||
RecollFilter::set_document_file(fn);
|
RecollFilter::set_document_file(fn);
|
||||||
|
|||||||
@ -51,33 +51,33 @@ static multimap<string, Dijon::Filter*> o_handlers;
|
|||||||
|
|
||||||
/** For mime types set as "internal" in mimeconf:
|
/** For mime types set as "internal" in mimeconf:
|
||||||
* create appropriate handler object. */
|
* create appropriate handler object. */
|
||||||
static Dijon::Filter *mhFactory(const string &mime)
|
static Dijon::Filter *mhFactory(RclConfig *config, const string &mime)
|
||||||
{
|
{
|
||||||
LOGDEB2(("mhFactory(%s)\n", mime.c_str()));
|
LOGDEB2(("mhFactory(%s)\n", mime.c_str()));
|
||||||
string lmime(mime);
|
string lmime(mime);
|
||||||
stringtolower(lmime);
|
stringtolower(lmime);
|
||||||
if ("text/plain" == lmime) {
|
if ("text/plain" == lmime) {
|
||||||
return new MimeHandlerText(lmime);
|
return new MimeHandlerText(config, lmime);
|
||||||
} else if ("text/html" == lmime) {
|
} else if ("text/html" == lmime) {
|
||||||
return new MimeHandlerHtml(lmime);
|
return new MimeHandlerHtml(config, lmime);
|
||||||
} else if ("text/x-mail" == lmime) {
|
} else if ("text/x-mail" == lmime) {
|
||||||
return new MimeHandlerMbox(lmime);
|
return new MimeHandlerMbox(config, lmime);
|
||||||
} else if ("message/rfc822" == lmime) {
|
} else if ("message/rfc822" == lmime) {
|
||||||
return new MimeHandlerMail(lmime);
|
return new MimeHandlerMail(config, lmime);
|
||||||
} else if (lmime.find("text/") == 0) {
|
} else if (lmime.find("text/") == 0) {
|
||||||
// Try to handle unknown text/xx as text/plain. This
|
// Try to handle unknown text/xx as text/plain. This
|
||||||
// only happen if the text/xx was defined as "internal" in
|
// only happen if the text/xx was defined as "internal" in
|
||||||
// mimeconf, not at random. For programs, for example this
|
// mimeconf, not at random. For programs, for example this
|
||||||
// allows indexing and previewing as text/plain (no filter
|
// allows indexing and previewing as text/plain (no filter
|
||||||
// exec) but still opening with a specific editor.
|
// exec) but still opening with a specific editor.
|
||||||
return new MimeHandlerText(lmime);
|
return new MimeHandlerText(config, lmime);
|
||||||
} else {
|
} else {
|
||||||
// We should not get there. It means that "internal" was set
|
// We should not get there. It means that "internal" was set
|
||||||
// as a handler in mimeconf for a mime type we actually can't
|
// as a handler in mimeconf for a mime type we actually can't
|
||||||
// handle.
|
// handle.
|
||||||
LOGERR(("mhFactory: mime type [%s] set as internal but unknown\n",
|
LOGERR(("mhFactory: mime type [%s] set as internal but unknown\n",
|
||||||
lmime.c_str()));
|
lmime.c_str()));
|
||||||
return new MimeHandlerUnknown(lmime);
|
return new MimeHandlerUnknown(config, lmime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MimeHandlerExec *h = multiple ?
|
MimeHandlerExec *h = multiple ?
|
||||||
new MimeHandlerExecMultiple(mtype.c_str()) :
|
new MimeHandlerExecMultiple(cfg, mtype.c_str()) :
|
||||||
new MimeHandlerExec(mtype.c_str());
|
new MimeHandlerExec(cfg, mtype.c_str());
|
||||||
list<string>::iterator it = cmdtoks.begin();
|
list<string>::iterator it = cmdtoks.begin();
|
||||||
h->params.push_back(cfg->findFilter(*it++));
|
h->params.push_back(cfg->findFilter(*it++));
|
||||||
h->params.insert(h->params.end(), it, cmdtoks.end());
|
h->params.insert(h->params.end(), it, cmdtoks.end());
|
||||||
@ -205,9 +205,9 @@ Dijon::Filter *getMimeHandler(const string &mtype, RclConfig *cfg,
|
|||||||
// point in the future
|
// point in the future
|
||||||
LOGDEB2(("handlertype internal, cmdstr [%s]\n", cmdstr.c_str()));
|
LOGDEB2(("handlertype internal, cmdstr [%s]\n", cmdstr.c_str()));
|
||||||
if (!cmdstr.empty())
|
if (!cmdstr.empty())
|
||||||
h = mhFactory(cmdstr);
|
h = mhFactory(cfg, cmdstr);
|
||||||
else
|
else
|
||||||
h = mhFactory(mtype);
|
h = mhFactory(cfg, mtype);
|
||||||
goto out;
|
goto out;
|
||||||
} else if (!stringlowercmp("dll", handlertype)) {
|
} else if (!stringlowercmp("dll", handlertype)) {
|
||||||
} else {
|
} else {
|
||||||
@ -247,7 +247,7 @@ Dijon::Filter *getMimeHandler(const string &mtype, RclConfig *cfg,
|
|||||||
{bool indexunknown = false;
|
{bool indexunknown = false;
|
||||||
cfg->getConfParam("indexallfilenames", &indexunknown);
|
cfg->getConfParam("indexallfilenames", &indexunknown);
|
||||||
if (indexunknown) {
|
if (indexunknown) {
|
||||||
h = new MimeHandlerUnknown("application/octet-stream");
|
h = new MimeHandlerUnknown(cfg, "application/octet-stream");
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
@ -30,8 +30,9 @@ class RclConfig;
|
|||||||
|
|
||||||
class RecollFilter : public Dijon::Filter {
|
class RecollFilter : public Dijon::Filter {
|
||||||
public:
|
public:
|
||||||
RecollFilter(const string& mtype)
|
RecollFilter(RclConfig *config, const string& mtype)
|
||||||
: Dijon::Filter(mtype), m_forPreview(false), m_havedoc(false)
|
: Dijon::Filter(mtype), m_config(config),
|
||||||
|
m_forPreview(false), m_havedoc(false)
|
||||||
{}
|
{}
|
||||||
virtual ~RecollFilter() {}
|
virtual ~RecollFilter() {}
|
||||||
virtual bool set_property(Properties p, const string &v) {
|
virtual bool set_property(Properties p, const string &v) {
|
||||||
@ -93,6 +94,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
RclConfig *m_config;
|
||||||
bool m_forPreview;
|
bool m_forPreview;
|
||||||
string m_dfltInputCharset;
|
string m_dfltInputCharset;
|
||||||
string m_reason;
|
string m_reason;
|
||||||
|
|||||||
@ -302,5 +302,5 @@ void RecollProtocol::htmlDoSearch(const QueryDesc& qd)
|
|||||||
m_pager.resultPageBack();
|
m_pager.resultPageBack();
|
||||||
}
|
}
|
||||||
// Display
|
// Display
|
||||||
m_pager.displayPage();
|
m_pager.displayPage(o_rclconfig);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,11 +53,6 @@ using namespace KIO;
|
|||||||
|
|
||||||
RclConfig *RecollProtocol::o_rclconfig;
|
RclConfig *RecollProtocol::o_rclconfig;
|
||||||
|
|
||||||
RclConfig *RclConfig::getMainConfig()
|
|
||||||
{
|
|
||||||
return RecollProtocol::o_rclconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
RecollProtocol::RecollProtocol(const QByteArray &pool, const QByteArray &app)
|
RecollProtocol::RecollProtocol(const QByteArray &pool, const QByteArray &app)
|
||||||
: SlaveBase("recoll", pool, app), m_initok(false), m_rcldb(0),
|
: SlaveBase("recoll", pool, app), m_initok(false), m_rcldb(0),
|
||||||
m_alwaysdir(false)
|
m_alwaysdir(false)
|
||||||
|
|||||||
@ -1204,11 +1204,6 @@ static PyMethodDef recollMethods[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
RclConfig *RclConfig::getMainConfig()
|
|
||||||
{
|
|
||||||
return rclconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyDoc_STRVAR(pyrecoll_doc_string,
|
PyDoc_STRVAR(pyrecoll_doc_string,
|
||||||
"This is an interface to the Recoll full text indexer.");
|
"This is an interface to the Recoll full text indexer.");
|
||||||
|
|
||||||
|
|||||||
@ -106,10 +106,6 @@ Usage(void)
|
|||||||
|
|
||||||
|
|
||||||
static RclConfig *config;
|
static RclConfig *config;
|
||||||
RclConfig *RclConfig::getMainConfig()
|
|
||||||
{
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -145,7 +145,7 @@ string QtGuiResListPager::pageTop()
|
|||||||
string QtGuiResListPager::iconPath(const string& mtype)
|
string QtGuiResListPager::iconPath(const string& mtype)
|
||||||
{
|
{
|
||||||
string iconpath;
|
string iconpath;
|
||||||
RclConfig::getMainConfig()->getMimeIconName(mtype, &iconpath);
|
rclconfig->getMimeIconName(mtype, &iconpath);
|
||||||
return iconpath;
|
return iconpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ void ResList::displayPage()
|
|||||||
{
|
{
|
||||||
m_pageParaToReldocnums.clear();
|
m_pageParaToReldocnums.clear();
|
||||||
clear();
|
clear();
|
||||||
m_pager->displayPage();
|
m_pager->displayPage(rclconfig);
|
||||||
LOGDEB0(("ResList::resultPageNext: hasNext %d hasPrev %d\n",
|
LOGDEB0(("ResList::resultPageNext: hasNext %d hasPrev %d\n",
|
||||||
m_pager->hasPrev(), m_pager->hasNext()));
|
m_pager->hasPrev(), m_pager->hasNext()));
|
||||||
emit prevPageAvailable(m_pager->hasPrev());
|
emit prevPageAvailable(m_pager->hasPrev());
|
||||||
|
|||||||
@ -19,6 +19,7 @@ static char rcsid[] = "@(#$Id: reslist.cpp,v 1.52 2008-12-17 15:12:08 dockes Exp
|
|||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
#include "recoll.h"
|
||||||
#include "refcntr.h"
|
#include "refcntr.h"
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
@ -84,7 +85,7 @@ const string& ResTablePager::parFormat()
|
|||||||
string ResTablePager::iconPath(const string& mtype)
|
string ResTablePager::iconPath(const string& mtype)
|
||||||
{
|
{
|
||||||
string iconpath;
|
string iconpath;
|
||||||
RclConfig::getMainConfig()->getMimeIconName(mtype, &iconpath);
|
rclconfig->getMimeIconName(mtype, &iconpath);
|
||||||
return iconpath;
|
return iconpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,9 +180,8 @@ RecollModel::RecollModel(const QStringList fields, QObject *parent)
|
|||||||
// Add dynamic "stored" fields to the full column list. This
|
// Add dynamic "stored" fields to the full column list. This
|
||||||
// could be protected to be done only once, but it's no real
|
// could be protected to be done only once, but it's no real
|
||||||
// problem
|
// problem
|
||||||
RclConfig *config = RclConfig::getMainConfig();
|
if (rclconfig) {
|
||||||
if (config) {
|
const set<string>& stored = rclconfig->getStoredFields();
|
||||||
const set<string>& stored = config->getStoredFields();
|
|
||||||
for (set<string>::const_iterator it = stored.begin();
|
for (set<string>::const_iterator it = stored.begin();
|
||||||
it != stored.end(); it++) {
|
it != stored.end(); it++) {
|
||||||
if (o_displayableFields.find(*it) == o_displayableFields.end()) {
|
if (o_displayableFields.find(*it) == o_displayableFields.end()) {
|
||||||
@ -488,7 +488,7 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index)
|
|||||||
if (m_model->getDocSource()->getDoc(index.row(), doc)) {
|
if (m_model->getDocSource()->getDoc(index.row(), doc)) {
|
||||||
textBrowser->clear();
|
textBrowser->clear();
|
||||||
m_detaildocnum = index.row();
|
m_detaildocnum = index.row();
|
||||||
m_pager->displayDoc(index.row(), doc, m_model->m_hdata);
|
m_pager->displayDoc(rclconfig, index.row(), doc, m_model->m_hdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -135,9 +135,9 @@ void SSearch::startSimpleSearch()
|
|||||||
if (tp == SST_LANG) {
|
if (tp == SST_LANG) {
|
||||||
string reason;
|
string reason;
|
||||||
if (prefs.autoSuffsEnable)
|
if (prefs.autoSuffsEnable)
|
||||||
sdata = wasaStringToRcl(u8, reason, (const char *)prefs.autoSuffs.toUtf8());
|
sdata = wasaStringToRcl(rclconfig, u8, reason, (const char *)prefs.autoSuffs.toUtf8());
|
||||||
else
|
else
|
||||||
sdata = wasaStringToRcl(u8, reason);
|
sdata = wasaStringToRcl(rclconfig, u8, reason);
|
||||||
if (sdata == 0) {
|
if (sdata == 0) {
|
||||||
QMessageBox::warning(0, "Recoll", tr("Bad query string") +
|
QMessageBox::warning(0, "Recoll", tr("Bad query string") +
|
||||||
QString::fromAscii(reason.c_str()));
|
QString::fromAscii(reason.c_str()));
|
||||||
|
|||||||
@ -375,7 +375,7 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
|||||||
}
|
}
|
||||||
struct stat st1, st2;
|
struct stat st1, st2;
|
||||||
stat(dbdir.c_str(), &st1);
|
stat(dbdir.c_str(), &st1);
|
||||||
string rcldbdir = RclConfig::getMainConfig()->getDbDir();
|
string rcldbdir = rclconfig->getDbDir();
|
||||||
stat(rcldbdir.c_str(), &st2);
|
stat(rcldbdir.c_str(), &st2);
|
||||||
path_catslash(rcldbdir);
|
path_catslash(rcldbdir);
|
||||||
|
|
||||||
|
|||||||
@ -248,7 +248,7 @@ int recollq(RclConfig **cfp, int argc, char **argv)
|
|||||||
if (sd)
|
if (sd)
|
||||||
sd->addClause(clp);
|
sd->addClause(clp);
|
||||||
} else {
|
} else {
|
||||||
sd = wasaStringToRcl(qs, reason);
|
sd = wasaStringToRcl(rclconfig, qs, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sd) {
|
if (!sd) {
|
||||||
@ -325,11 +325,6 @@ int recollq(RclConfig **cfp, int argc, char **argv)
|
|||||||
|
|
||||||
static RclConfig *rclconfig;
|
static RclConfig *rclconfig;
|
||||||
|
|
||||||
RclConfig *RclConfig::getMainConfig()
|
|
||||||
{
|
|
||||||
return rclconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
exit(recollq(&rclconfig, argc, argv));
|
exit(recollq(&rclconfig, argc, argv));
|
||||||
|
|||||||
@ -78,7 +78,8 @@ void ResListPager::resultPageNext()
|
|||||||
m_respage = npage;
|
m_respage = npage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResListPager::displayDoc(int i, Rcl::Doc& doc, const HiliteData& hdata,
|
void ResListPager::displayDoc(RclConfig *config,
|
||||||
|
int i, Rcl::Doc& doc, const HiliteData& hdata,
|
||||||
const string& sh)
|
const string& sh)
|
||||||
{
|
{
|
||||||
ostringstream chunk;
|
ostringstream chunk;
|
||||||
@ -92,11 +93,11 @@ void ResListPager::displayDoc(int i, Rcl::Doc& doc, const HiliteData& hdata,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine icon to display if any
|
// Determine icon to display if any
|
||||||
string iconpath = iconPath(doc.mimetype);
|
string iconpath = iconPath(config, doc.mimetype);
|
||||||
|
|
||||||
// Printable url: either utf-8 if transcoding succeeds, or url-encoded
|
// Printable url: either utf-8 if transcoding succeeds, or url-encoded
|
||||||
string url;
|
string url;
|
||||||
printableUrl(RclConfig::getMainConfig()->getDefCharset(), doc.url, url);
|
printableUrl(config->getDefCharset(), doc.url, url);
|
||||||
|
|
||||||
// Make title out of file name if none yet
|
// Make title out of file name if none yet
|
||||||
if (doc.meta[Rcl::Doc::keytt].empty()) {
|
if (doc.meta[Rcl::Doc::keytt].empty()) {
|
||||||
@ -149,7 +150,7 @@ void ResListPager::displayDoc(int i, Rcl::Doc& doc, const HiliteData& hdata,
|
|||||||
|
|
||||||
// Links;
|
// Links;
|
||||||
ostringstream linksbuf;
|
ostringstream linksbuf;
|
||||||
if (canIntern(doc.mimetype, RclConfig::getMainConfig())) {
|
if (canIntern(doc.mimetype, config)) {
|
||||||
linksbuf << "<a href=\"P" << docnumforlinks << "\">"
|
linksbuf << "<a href=\"P" << docnumforlinks << "\">"
|
||||||
<< trans("Preview") << "</a> ";
|
<< trans("Preview") << "</a> ";
|
||||||
}
|
}
|
||||||
@ -159,7 +160,7 @@ void ResListPager::displayDoc(int i, Rcl::Doc& doc, const HiliteData& hdata,
|
|||||||
if ((it = doc.meta.find(Rcl::Doc::keyapptg)) != doc.meta.end())
|
if ((it = doc.meta.find(Rcl::Doc::keyapptg)) != doc.meta.end())
|
||||||
apptag = it->second;
|
apptag = it->second;
|
||||||
|
|
||||||
if (!RclConfig::getMainConfig()->getMimeViewerDef(doc.mimetype, apptag).empty()) {
|
if (!config->getMimeViewerDef(doc.mimetype, apptag).empty()) {
|
||||||
linksbuf << "<a href=\"E" << docnumforlinks << "\">"
|
linksbuf << "<a href=\"E" << docnumforlinks << "\">"
|
||||||
<< trans("Open") << "</a>";
|
<< trans("Open") << "</a>";
|
||||||
}
|
}
|
||||||
@ -205,7 +206,7 @@ void ResListPager::displayDoc(int i, Rcl::Doc& doc, const HiliteData& hdata,
|
|||||||
append(chunk.rdbuf()->str(), i, doc);
|
append(chunk.rdbuf()->str(), i, doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResListPager::displayPage()
|
void ResListPager::displayPage(RclConfig *config)
|
||||||
{
|
{
|
||||||
LOGDEB(("ResListPager::displayPage\n"));
|
LOGDEB(("ResListPager::displayPage\n"));
|
||||||
if (m_docSource.isNull()) {
|
if (m_docSource.isNull()) {
|
||||||
@ -296,7 +297,7 @@ void ResListPager::displayPage()
|
|||||||
for (int i = 0; i < (int)m_respage.size(); i++) {
|
for (int i = 0; i < (int)m_respage.size(); i++) {
|
||||||
Rcl::Doc &doc(m_respage[i].doc);
|
Rcl::Doc &doc(m_respage[i].doc);
|
||||||
string& sh(m_respage[i].subHeader);
|
string& sh(m_respage[i].subHeader);
|
||||||
displayDoc(i, doc, hdata, sh);
|
displayDoc(config, i, doc, hdata, sh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Footer
|
// Footer
|
||||||
@ -330,10 +331,10 @@ string ResListPager::prevUrl()
|
|||||||
return "p-1";
|
return "p-1";
|
||||||
}
|
}
|
||||||
|
|
||||||
string ResListPager::iconPath(const string& mtype)
|
string ResListPager::iconPath(RclConfig *config, const string& mtype)
|
||||||
{
|
{
|
||||||
string iconpath;
|
string iconpath;
|
||||||
RclConfig::getMainConfig()->getMimeIconName(mtype, &iconpath);
|
config->getMimeIconName(mtype, &iconpath);
|
||||||
iconpath = string("file://") + iconpath;
|
iconpath = string("file://") + iconpath;
|
||||||
return iconpath;
|
return iconpath;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using std::vector;
|
|||||||
#include "refcntr.h"
|
#include "refcntr.h"
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
|
|
||||||
|
class RclConfig;
|
||||||
class PlainToRich;
|
class PlainToRich;
|
||||||
class HiliteData;
|
class HiliteData;
|
||||||
|
|
||||||
@ -65,9 +66,9 @@ public:
|
|||||||
resultPageNext();
|
resultPageNext();
|
||||||
}
|
}
|
||||||
void resultPageNext();
|
void resultPageNext();
|
||||||
void displayPage();
|
void displayPage(RclConfig *);
|
||||||
void displayDoc(int idx, Rcl::Doc& doc, const HiliteData& hdata,
|
void displayDoc(RclConfig *, int idx, Rcl::Doc& doc,
|
||||||
const string& sh = "");
|
const HiliteData& hdata, const string& sh = "");
|
||||||
bool pageEmpty() {return m_respage.size() == 0;}
|
bool pageEmpty() {return m_respage.size() == 0;}
|
||||||
|
|
||||||
string queryDescription() {return m_docSource.isNull() ? "" :
|
string queryDescription() {return m_docSource.isNull() ? "" :
|
||||||
@ -91,7 +92,7 @@ public:
|
|||||||
virtual string nextUrl();
|
virtual string nextUrl();
|
||||||
virtual string prevUrl();
|
virtual string prevUrl();
|
||||||
virtual string pageTop() {return string();}
|
virtual string pageTop() {return string();}
|
||||||
virtual string iconPath(const string& mtype);
|
virtual string iconPath(RclConfig *, const string& mtype);
|
||||||
virtual void suggest(const vector<string>, vector<string>&sugg) {
|
virtual void suggest(const vector<string>, vector<string>&sugg) {
|
||||||
sugg.clear();
|
sugg.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ static char rcsid[] = "@(#$Id: wasatorcl.cpp,v 1.18 2008-12-05 11:09:31 dockes E
|
|||||||
using std::string;
|
using std::string;
|
||||||
using std::list;
|
using std::list;
|
||||||
|
|
||||||
|
#include "rclconfig.h"
|
||||||
#include "wasastringtoquery.h"
|
#include "wasastringtoquery.h"
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
@ -34,14 +35,15 @@ using std::list;
|
|||||||
#include "refcntr.h"
|
#include "refcntr.h"
|
||||||
#include "textsplit.h"
|
#include "textsplit.h"
|
||||||
|
|
||||||
Rcl::SearchData *wasaStringToRcl(const string &qs, string &reason,
|
Rcl::SearchData *wasaStringToRcl(RclConfig *config,
|
||||||
|
const string &qs, string &reason,
|
||||||
const string& autosuffs)
|
const string& autosuffs)
|
||||||
{
|
{
|
||||||
StringToWasaQuery parser;
|
StringToWasaQuery parser;
|
||||||
WasaQuery *wq = parser.stringToQuery(qs, reason);
|
WasaQuery *wq = parser.stringToQuery(qs, reason);
|
||||||
if (wq == 0)
|
if (wq == 0)
|
||||||
return 0;
|
return 0;
|
||||||
Rcl::SearchData *rq = wasaQueryToRcl(wq, autosuffs);
|
Rcl::SearchData *rq = wasaQueryToRcl(config, wq, autosuffs);
|
||||||
if (rq == 0) {
|
if (rq == 0) {
|
||||||
reason = "Failed translating xesam query structure to recoll";
|
reason = "Failed translating xesam query structure to recoll";
|
||||||
return 0;
|
return 0;
|
||||||
@ -49,7 +51,8 @@ Rcl::SearchData *wasaStringToRcl(const string &qs, string &reason,
|
|||||||
return rq;
|
return rq;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rcl::SearchData *wasaQueryToRcl(WasaQuery *wasa, const string& autosuffs)
|
Rcl::SearchData *wasaQueryToRcl(RclConfig *config,
|
||||||
|
WasaQuery *wasa, const string& autosuffs)
|
||||||
{
|
{
|
||||||
if (wasa == 0)
|
if (wasa == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -91,9 +94,8 @@ Rcl::SearchData *wasaQueryToRcl(WasaQuery *wasa, const string& autosuffs)
|
|||||||
// categories like "audio", "presentation", etc.
|
// categories like "audio", "presentation", etc.
|
||||||
if (!stringicmp("rclcat", (*it)->m_fieldspec) ||
|
if (!stringicmp("rclcat", (*it)->m_fieldspec) ||
|
||||||
!stringicmp("type", (*it)->m_fieldspec)) {
|
!stringicmp("type", (*it)->m_fieldspec)) {
|
||||||
RclConfig *conf = RclConfig::getMainConfig();
|
|
||||||
list<string> mtypes;
|
list<string> mtypes;
|
||||||
if (conf && conf->getMimeCatTypes((*it)->m_value, mtypes)) {
|
if (config && config->getMimeCatTypes((*it)->m_value, mtypes)) {
|
||||||
for (list<string>::iterator mit = mtypes.begin();
|
for (list<string>::iterator mit = mtypes.begin();
|
||||||
mit != mtypes.end(); mit++) {
|
mit != mtypes.end(); mit++) {
|
||||||
sdata->addFiletype(*mit);
|
sdata->addFiletype(*mit);
|
||||||
@ -192,7 +194,7 @@ Rcl::SearchData *wasaQueryToRcl(WasaQuery *wasa, const string& autosuffs)
|
|||||||
LOGDEB2(("wasaQueryToRcl: OR clause [%s]:[%s]\n",
|
LOGDEB2(("wasaQueryToRcl: OR clause [%s]:[%s]\n",
|
||||||
(*it)->m_fieldspec.c_str(), (*it)->m_value.c_str()));
|
(*it)->m_fieldspec.c_str(), (*it)->m_value.c_str()));
|
||||||
// Create a subquery.
|
// Create a subquery.
|
||||||
Rcl::SearchData *sub = wasaQueryToRcl(*it);
|
Rcl::SearchData *sub = wasaQueryToRcl(config, *it);
|
||||||
if (sub == 0) {
|
if (sub == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,10 +24,13 @@ using std::string;
|
|||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
|
|
||||||
extern Rcl::SearchData *wasaStringToRcl(const string& query, string &reason,
|
class RclConfig;
|
||||||
const string& autosuffs = string());
|
|
||||||
|
extern Rcl::SearchData *wasaStringToRcl(RclConfig *,
|
||||||
|
const string& query, string &reason,
|
||||||
|
const string& autosuffs = string());
|
||||||
class WasaQuery;
|
class WasaQuery;
|
||||||
extern Rcl::SearchData *wasaQueryToRcl(WasaQuery *wasa,
|
extern Rcl::SearchData *wasaQueryToRcl(RclConfig *, WasaQuery *wasa,
|
||||||
const string& autosuffs = string());
|
const string& autosuffs = string());
|
||||||
|
|
||||||
#endif /* _WASATORCL_H_INCLUDED_ */
|
#endif /* _WASATORCL_H_INCLUDED_ */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user