indexing: allow setting a maxseconds parameter on mimeconf lines. Allows setting a specific 30S value for text/man which should be fast but sometimes goes looping
This commit is contained in:
parent
cf3b218a35
commit
9b24501f57
@ -63,9 +63,7 @@ void MEAdv::newData(int n)
|
||||
|
||||
|
||||
MimeHandlerExec::MimeHandlerExec(RclConfig *cnf, const std::string& id)
|
||||
: RecollFilter(cnf, id), missingHelper(false), m_filtermaxseconds(900),
|
||||
m_filtermaxmbytes(0), m_handlernomd5(false), m_hnomd5init(false),
|
||||
m_nomd5(false)
|
||||
: RecollFilter(cnf, id)
|
||||
{
|
||||
m_config->getConfParam("filtermaxseconds", &m_filtermaxseconds);
|
||||
m_config->getConfParam("filtermaxmbytes", &m_filtermaxmbytes);
|
||||
|
||||
@ -44,7 +44,7 @@ class HandlerTimeout {};
|
||||
* (cmd, params etc.)
|
||||
*/
|
||||
class MimeHandlerExec : public RecollFilter {
|
||||
public:
|
||||
public:
|
||||
///////////////////////
|
||||
// Members not reset by clear(). params, cfgFilterOutputMtype and
|
||||
// cfgFilterOutputCharset
|
||||
@ -62,33 +62,42 @@ class MimeHandlerExec : public RecollFilter {
|
||||
// those filters, the output charset has to be known: ie set by a command
|
||||
// line option.
|
||||
std::string cfgFilterOutputCharset;
|
||||
bool missingHelper;
|
||||
bool missingHelper{false};
|
||||
// Resource management values
|
||||
int m_filtermaxseconds;
|
||||
int m_filtermaxmbytes;
|
||||
|
||||
// The filtermaxseconds default is set in the constructor by
|
||||
// querying the recoll.conf configuration variable. It can be
|
||||
// changed by the filter creation code in mimehandler.cpp if a
|
||||
// maxseconds parameter is set on the mimeconf line.
|
||||
int m_filtermaxseconds{900};
|
||||
int m_filtermaxmbytes{0};
|
||||
////////////////
|
||||
|
||||
MimeHandlerExec(RclConfig *cnf, const std::string& id);
|
||||
|
||||
virtual void setmaxseconds(int seconds) {
|
||||
m_filtermaxseconds = seconds;
|
||||
}
|
||||
|
||||
virtual bool next_document() override;
|
||||
virtual bool skip_to_document(const std::string& ipath) override;
|
||||
|
||||
virtual void clear_impl() override {
|
||||
m_fn.erase();
|
||||
m_ipath.erase();
|
||||
m_fn.erase();
|
||||
m_ipath.erase();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool set_document_file_impl(const std::string& mt,
|
||||
const std::string& file_path) override;
|
||||
virtual bool set_document_file_impl(
|
||||
const std::string& mt, const std::string& file_path) override;
|
||||
|
||||
std::string m_fn;
|
||||
std::string m_ipath;
|
||||
// md5 computation excluded by handler name: can't change after init
|
||||
bool m_handlernomd5;
|
||||
bool m_hnomd5init;
|
||||
bool m_handlernomd5{false};
|
||||
bool m_hnomd5init{false};
|
||||
// If md5 not excluded by handler name, allow/forbid depending on mime
|
||||
bool m_nomd5;
|
||||
bool m_nomd5{false};
|
||||
|
||||
// Set the character set field and possibly transcode text/plain
|
||||
// output.
|
||||
|
||||
@ -202,6 +202,7 @@ static RecollFilter *mhFactory(RclConfig *config, const string &mimeOrParams,
|
||||
}
|
||||
|
||||
static const string cstr_mh_charset("charset");
|
||||
static const string cstr_mh_maxseconds("maxseconds");
|
||||
/**
|
||||
* Create a filter that executes an external program or script
|
||||
* A filter def can look like:
|
||||
@ -245,7 +246,9 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
|
||||
h->cfgFilterOutputCharset = stringtolower((const string&)value);
|
||||
if (attrs.get(cstr_dj_keymt, value))
|
||||
h->cfgFilterOutputMtype = stringtolower((const string&)value);
|
||||
|
||||
if (attrs.get(cstr_mh_maxseconds, value)) {
|
||||
h->setmaxseconds(atoi(value.c_str()));
|
||||
}
|
||||
LOGDEB2("mhExecFactory:mt [" << mtype << "] cfgmt [" <<
|
||||
h->cfgFilterOutputMtype << "] cfgcs ["<<h->cfgFilterOutputCharset <<
|
||||
"] cmd: [" << stringsToString(h->params) << "]\n");
|
||||
|
||||
@ -222,7 +222,7 @@ text/x-ini = internal text/plain
|
||||
text/x-java = internal text/plain
|
||||
text/x-lua = internal
|
||||
text/x-mail = internal
|
||||
text/x-man = exec rclman
|
||||
text/x-man = exec rclman;maxseconds=30
|
||||
text/x-orgmode = execm rclorgmode.py
|
||||
text/x-perl = internal text/plain
|
||||
text/x-purple-html-log = internal text/html
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user