logging now uses c++ streams

This commit is contained in:
Jean-Francois Dockes 2016-07-12 09:41:04 +02:00
parent 8fc0043de2
commit 12de4bb102
123 changed files with 1974 additions and 2760 deletions

View file

@ -25,7 +25,7 @@ COMMONCPPFLAGS = -I. \
-I$(top_srcdir)/xaposix \
-DBUILDING_RECOLL
AM_CPPFLAGS = -Wall -Wno-unused \
AM_CPPFLAGS = -Wall -Wno-unused -std=c++11 \
$(COMMONCPPFLAGS) \
$(INCICONV) \
$(XAPIANCXXFLAGS) \
@ -198,8 +198,6 @@ utils/copyfile.cpp \
utils/copyfile.h \
utils/cpuconf.cpp \
utils/cpuconf.h \
utils/debuglog.cpp \
utils/debuglog.h \
utils/ecrontab.cpp \
utils/ecrontab.h \
utils/execmd.cpp \
@ -212,6 +210,8 @@ utils/hldata.h \
utils/hldata.cpp \
utils/idfile.cpp \
utils/idfile.h \
utils/log.cpp \
utils/log.h \
utils/md5.cpp \
utils/md5.h \
utils/md5ut.cpp \

View file

@ -30,7 +30,7 @@
#include "pathut.h"
#include "execmd.h"
#include "rclaspell.h"
#include "debuglog.h"
#include "log.h"
#include "unacpp.h"
#include "ptmutex.h"
@ -84,7 +84,7 @@ public:
: m_handle(0), m_speller(0)
{}
~AspellData() {
LOGDEB2(("~AspellData\n"));
LOGDEB2("~AspellData\n" );
if (m_handle) {
dlclose(m_handle);
m_handle = 0;
@ -93,7 +93,7 @@ public:
// Dumps core if I do this??
//aapi.delete_aspell_speller(m_speller);
m_speller = 0;
LOGDEB2(("~AspellData: speller done\n"));
LOGDEB2("~AspellData: speller done\n" );
}
}
@ -240,9 +240,9 @@ public:
{}
void newData() {
while (m_db.termWalkNext(m_tit, *m_input)) {
LOGDEB2(("Aspell::buildDict: term: [%s]\n", m_input->c_str()));
LOGDEB2("Aspell::buildDict: term: [" << (m_input) << "]\n" );
if (!Rcl::Db::isSpellingCandidate(*m_input)) {
LOGDEB2(("Aspell::buildDict: SKIP\n"));
LOGDEB2("Aspell::buildDict: SKIP\n" );
continue;
}
if (!o_index_stripchars) {
@ -253,7 +253,7 @@ public:
}
// Got a non-empty sort-of appropriate term, let's send it to
// aspell
LOGDEB2(("Apell::buildDict: SEND\n"));
LOGDEB2("Apell::buildDict: SEND\n" );
m_input->append("\n");
return;
}
@ -370,7 +370,7 @@ bool Aspell::make_speller(string& reason)
bool Aspell::check(const string &iterm, string& reason)
{
LOGDEB2(("Aspell::check [%s]\n", iterm.c_str()));
LOGDEB2("Aspell::check [" << (iterm) << "]\n" );
string mterm(iterm);
if (!ok() || !make_speller(reason))
@ -381,7 +381,7 @@ bool Aspell::check(const string &iterm, string& reason)
if (!o_index_stripchars) {
string lower;
if (!unacmaybefold(mterm, lower, "UTF-8", UNACOP_FOLD)) {
LOGERR(("Aspell::check : cant lowercase input\n"));
LOGERR("Aspell::check : cant lowercase input\n" );
return false;
}
mterm.swap(lower);
@ -413,7 +413,7 @@ bool Aspell::suggest(Rcl::Db &db, const string &_term,
if (!o_index_stripchars) {
string lower;
if (!unacmaybefold(mterm, lower, "UTF-8", UNACOP_FOLD)) {
LOGERR(("Aspell::check : cant lowercase input\n"));
LOGERR("Aspell::check : cant lowercase input\n" );
return false;
}
mterm.swap(lower);
@ -584,3 +584,4 @@ int main(int argc, char **argv)
#endif // RCL_USE_ASPELL
#endif // TEST_RCLASPELL test driver

View file

@ -20,7 +20,7 @@
#include "cstr.h"
#include "beaglequeuecache.h"
#include "circache.h"
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "pathut.h"
#include "rcldoc.h"
@ -34,12 +34,11 @@ BeagleQueueCache::BeagleQueueCache(RclConfig *cnf)
int maxmbs = 40;
cnf->getConfParam("webcachemaxmbs", &maxmbs);
if ((m_cache = new CirCache(ccdir)) == 0) {
LOGERR(("BeagleQueueCache: cant create CirCache object\n"));
LOGERR("BeagleQueueCache: cant create CirCache object\n" );
return;
}
if (!m_cache->create(off_t(maxmbs)*1000*1024, CirCache::CC_CRUNIQUE)) {
LOGERR(("BeagleQueueCache: cache file creation failed: %s\n",
m_cache->getReason().c_str()));
LOGERR("BeagleQueueCache: cache file creation failed: " << (m_cache->getReason()) << "\n" );
delete m_cache;
m_cache = 0;
return;
@ -59,11 +58,11 @@ bool BeagleQueueCache::getFromCache(const string& udi, Rcl::Doc &dotdoc,
string dict;
if (m_cache == 0) {
LOGERR(("BeagleQueueCache::getFromCache: cache is null\n"));
LOGERR("BeagleQueueCache::getFromCache: cache is null\n" );
return false;
}
if (!m_cache->get(udi, dict, &data)) {
LOGDEB(("BeagleQueueCache::getFromCache: get failed\n"));
LOGDEB("BeagleQueueCache::getFromCache: get failed\n" );
return false;
}
@ -86,3 +85,4 @@ bool BeagleQueueCache::getFromCache(const string& udi, Rcl::Doc &dotdoc,
dotdoc.meta[Rcl::Doc::keyudi] = udi;
return true;
}

View file

@ -29,7 +29,6 @@
#ifdef _WIN32
#include "safewindows.h"
#undef RCL_ICONV_INBUF_CONST
#ifdef _MSC_VER
// gmtime is supposedly thread-safe on windows
@ -47,14 +46,14 @@ typedef int mode_t;
#else // End _MSC_VER -> Gminw
#define timegm portable_timegm
#undef RCL_ICONV_INBUF_CONST
#define timegm portable_timegm
#endif // GMinw only
typedef int pid_t;
inline int readlink(const char *cp, void *buf, int cnt) {
inline int readlink(const char *cp, void *buf, int cnt)
{
return -1;
}
@ -72,9 +71,8 @@ typedef int ssize_t;
#ifndef X_OK
#define X_OK 4
#endif
#define RECOLL_DATADIR "C:\\recoll\\"
#define S_ISLNK(X) false
#define lstat stat
#endif
#endif // _WIN32

View file

@ -42,7 +42,7 @@
#include "rclutil.h"
#include "rclconfig.h"
#include "conftree.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "textsplit.h"
#include "readfile.h"
@ -67,10 +67,9 @@ string RclConfig::o_origcwd;
bool ParamStale::needrecompute()
{
LOGDEB2(("ParamStale:: needrecompute. parent gen %d mine %d\n",
parent->m_keydirgen, savedkeydirgen));
LOGDEB2("ParamStale:: needrecompute. parent gen " << (parent->m_keydirgen) << " mine " << (savedkeydirgen) << "\n" );
if (active && parent->m_keydirgen != savedkeydirgen) {
LOGDEB2(("ParamState:: needrecompute. conffile %p\n", conffile));
LOGDEB2("ParamState:: needrecompute. conffile " << (conffile) << "\n" );
savedkeydirgen = parent->m_keydirgen;
string newvalue;
@ -79,8 +78,7 @@ bool ParamStale::needrecompute()
conffile->get(paramname, newvalue, parent->m_keydir);
if (newvalue.compare(savedvalue)) {
savedvalue = newvalue;
LOGDEB2(("ParamState:: needrecompute. return true newvalue [%s]\n",
newvalue.c_str()));
LOGDEB2("ParamState:: needrecompute. return true newvalue [" << (newvalue) << "]\n" );
return true;
}
}
@ -216,8 +214,7 @@ RclConfig::RclConfig(const string *argcnf)
// interface, Windows will never use utf-8
o_localecharset = "UTF-8";
#endif
LOGDEB1(("RclConfig::getDefCharset: localecharset [%s]\n",
o_localecharset.c_str()));
LOGDEB1("RclConfig::getDefCharset: localecharset [" << (o_localecharset) << "]\n" );
}
const char *cp;
@ -425,8 +422,7 @@ bool RclConfig::getConfParam(const string &name, vector<int> *vip,
char *ep;
vip->push_back(strtol(vs[i].c_str(), &ep, 0));
if (ep == vs[i].c_str()) {
LOGDEB(("RclConfig::getConfParam: bad int value in [%s]\n",
name.c_str()));
LOGDEB("RclConfig::getConfParam: bad int value in [" << (name) << "]\n" );
return false;
}
}
@ -442,16 +438,16 @@ void RclConfig::initThrConf()
vector<int> vq;
vector<int> vt;
if (!getConfParam("thrQSizes", &vq)) {
LOGINFO(("RclConfig::initThrConf: no thread info (queues)\n"));
LOGINFO("RclConfig::initThrConf: no thread info (queues)\n" );
goto out;
}
// If the first queue size is 0, autoconf is requested.
if (vq.size() > 0 && vq[0] == 0) {
LOGDEB(("RclConfig::initThrConf: autoconf requested\n"));
LOGDEB("RclConfig::initThrConf: autoconf requested\n" );
CpuConf cpus;
if (!getCpuConf(cpus) || cpus.ncpus < 1) {
LOGERR(("RclConfig::initThrConf: could not retrieve cpu conf\n"));
LOGERR("RclConfig::initThrConf: could not retrieve cpu conf\n" );
cpus.ncpus = 1;
}
// Arbitrarily set threads config based on number of CPUS. This also
@ -477,12 +473,12 @@ void RclConfig::initThrConf()
}
if (!getConfParam("thrTCounts", &vt) ) {
LOGINFO(("RclConfig::initThrConf: no thread info (threads)\n"));
LOGINFO("RclConfig::initThrConf: no thread info (threads)\n" );
goto out;
}
if (vq.size() != 3 || vt.size() != 3) {
LOGINFO(("RclConfig::initThrConf: bad thread info vector sizes\n"));
LOGINFO("RclConfig::initThrConf: bad thread info vector sizes\n" );
goto out;
}
@ -499,14 +495,13 @@ out:
") ";
}
LOGDEB(("RclConfig::initThrConf: chosen config (ql,nt): %s\n",
sconf.str().c_str()));
LOGDEB("RclConfig::initThrConf: chosen config (ql,nt): " << (sconf.str()) << "\n" );
}
pair<int,int> RclConfig::getThrConf(ThrStage who) const
{
if (m_thrConf.size() != 3) {
LOGERR(("RclConfig::getThrConf: bad data in rclconfig\n"));
LOGERR("RclConfig::getThrConf: bad data in rclconfig\n" );
return pair<int,int>(-1,-1);
}
return m_thrConf[who];
@ -516,8 +511,7 @@ vector<string> RclConfig::getTopdirs() const
{
vector<string> tdl;
if (!getConfParam("topdirs", &tdl)) {
LOGERR(("RclConfig::getTopdirs: no top directories in config or "
"bad list format\n"));
LOGERR("RclConfig::getTopdirs: no top directories in config or bad list format\n" );
return tdl;
}
@ -601,7 +595,7 @@ typedef multiset<SfString, SuffCmp> SuffixStore;
bool RclConfig::inStopSuffixes(const string& fni)
{
LOGDEB2(("RclConfig::inStopSuffixes(%s)\n", fni.c_str()));
LOGDEB2("RclConfig::inStopSuffixes(" << (fni) << ")\n" );
// Beware: both needrecompute() need to be called always hence the
// bizarre way we do things
bool needrecompute = m_stpsuffstate.needrecompute();
@ -610,7 +604,7 @@ bool RclConfig::inStopSuffixes(const string& fni)
// Need to initialize the suffixes
delete STOPSUFFIXES;
if ((m_stopsuffixes = new SuffixStore) == 0) {
LOGERR(("RclConfig::inStopSuffixes: out of memory\n"));
LOGERR("RclConfig::inStopSuffixes: out of memory\n" );
return false;
}
// Let the old customisation have priority: if recoll_noindex
@ -637,11 +631,10 @@ bool RclConfig::inStopSuffixes(const string& fni)
stringtolower(fn);
SuffixStore::const_iterator it = STOPSUFFIXES->find(fn);
if (it != STOPSUFFIXES->end()) {
LOGDEB2(("RclConfig::inStopSuffixes: Found (%s) [%s]\n",
fni.c_str(), (*it).m_str.c_str()));
LOGDEB2("RclConfig::inStopSuffixes: Found (" << (fni) << ") [" << ((*it).m_str) << "]\n" );
return true;
} else {
LOGDEB2(("RclConfig::inStopSuffixes: not found [%s]\n", fni.c_str()));
LOGDEB2("RclConfig::inStopSuffixes: not found [" << (fni) << "]\n" );
return false;
}
}
@ -718,18 +711,18 @@ string RclConfig::getMimeHandlerDef(const string &mtype, bool filtertypes)
}
if (!m_restrictMTypes.empty() &&
!m_restrictMTypes.count(stringtolower(mtype))) {
LOGDEB2(("RclConfig::getMimeHandlerDef: not in mime type list\n"));
LOGDEB2("RclConfig::getMimeHandlerDef: not in mime type list\n" );
return hs;
}
if (!m_excludeMTypes.empty() &&
m_excludeMTypes.count(stringtolower(mtype))) {
LOGDEB2(("RclConfig::getMimeHandlerDef: in excluded mime list\n"));
LOGDEB2("RclConfig::getMimeHandlerDef: in excluded mime list\n" );
return hs;
}
}
if (!mimeconf->get(mtype, hs, "index")) {
LOGDEB1(("getMimeHandler: no handler for '%s'\n", mtype.c_str()));
LOGDEB1("getMimeHandler: no handler for '" << (mtype) << "'\n" );
}
return hs;
}
@ -820,7 +813,7 @@ void RclConfig::storeMissingHelperDesc(const string &s)
FILE *fp = fopen(fmiss.c_str(), "w");
if (fp) {
if (s.size() > 0 && fwrite(s.c_str(), s.size(), 1, fp) != 1) {
LOGERR(("storeMissingHelperDesc: fwrite failed\n"));
LOGERR("storeMissingHelperDesc: fwrite failed\n" );
}
fclose(fp);
}
@ -830,7 +823,7 @@ void RclConfig::storeMissingHelperDesc(const string &s)
// things for speed (theses are used a lot during indexing)
bool RclConfig::readFieldsConfig(const string& cnferrloc)
{
LOGDEB2(("RclConfig::readFieldsConfig\n"));
LOGDEB2("RclConfig::readFieldsConfig\n" );
m_fields = new ConfStack<ConfSimple>("fields", m_cdirs, true);
if (m_fields == 0 || !m_fields->ok()) {
m_reason = string("No/bad fields file in: ") + cnferrloc;
@ -848,8 +841,7 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc)
ConfSimple attrs;
FieldTraits ft;
if (!valueSplitAttributes(val, ft.pfx, attrs)) {
LOGERR(("readFieldsConfig: bad config line for [%s]: [%s]\n",
it->c_str(), val.c_str()));
LOGERR("readFieldsConfig: bad config line for [" << *it << "]: [" << (val) << "]\n" );
return 0;
}
string tval;
@ -862,8 +854,7 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc)
if (attrs.get("noterms", tval))
ft.noterms = stringToBool(tval);
m_fldtotraits[stringtolower(*it)] = ft;
LOGDEB2(("readFieldsConfig: [%s] -> [%s] %d %.1f\n",
it->c_str(), ft.pfx.c_str(), ft.wdfinc, ft.boost));
LOGDEB2("readFieldsConfig: [" << *it << "] -> [" << (ft.pfx) << "] " << (ft.wdfinc) << " " << (ft.boost) << "\n" );
}
// Add prefixes for aliases and build alias-to-canonic map while
@ -909,9 +900,7 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc)
#if 0
for (map<string, FieldTraits>::const_iterator it = m_fldtotraits.begin();
it != m_fldtotraits.end(); it++) {
LOGDEB(("readFieldsConfig: [%s] -> [%s] %d %.1f\n",
it->c_str(), it->second.pfx.c_str(), it->second.wdfinc,
it->second.boost));
LOGDEB("readFieldsConfig: [" << *it << "] -> [" << (it->second.pfx) << "] " << (it->second.wdfinc) << " " << (it->second.boost) << "\n" );
}
#endif
@ -944,12 +933,10 @@ bool RclConfig::getFieldTraits(const string& _fld, const FieldTraits **ftpp,
map<string, FieldTraits>::const_iterator pit = m_fldtotraits.find(fld);
if (pit != m_fldtotraits.end()) {
*ftpp = &pit->second;
LOGDEB1(("RclConfig::getFieldTraits: [%s]->[%s]\n",
_fld.c_str(), pit->second.pfx.c_str()));
LOGDEB1("RclConfig::getFieldTraits: [" << (_fld) << "]->[" << (pit->second.pfx) << "]\n" );
return true;
} else {
LOGDEB1(("RclConfig::getFieldTraits: no prefix for field [%s]\n",
fld.c_str()));
LOGDEB1("RclConfig::getFieldTraits: no prefix for field [" << (fld) << "]\n" );
*ftpp = 0;
return false;
}
@ -971,11 +958,10 @@ string RclConfig::fieldCanon(const string& f) const
string fld = stringtolower(f);
map<string, string>::const_iterator it = m_aliastocanon.find(fld);
if (it != m_aliastocanon.end()) {
LOGDEB1(("RclConfig::fieldCanon: [%s] -> [%s]\n",
f.c_str(), it->second.c_str()));
LOGDEB1("RclConfig::fieldCanon: [" << (f) << "] -> [" << (it->second) << "]\n" );
return it->second;
}
LOGDEB1(("RclConfig::fieldCanon: [%s] -> [%s]\n", f.c_str(), fld.c_str()));
LOGDEB1("RclConfig::fieldCanon: [" << (f) << "] -> [" << (fld) << "]\n" );
return fld;
}
@ -984,8 +970,7 @@ string RclConfig::fieldQCanon(const string& f) const
string fld = stringtolower(f);
map<string, string>::const_iterator it = m_aliastoqcanon.find(fld);
if (it != m_aliastoqcanon.end()) {
LOGDEB1(("RclConfig::fieldQCanon: [%s] -> [%s]\n",
f.c_str(), it->second.c_str()));
LOGDEB1("RclConfig::fieldQCanon: [" << (f) << "] -> [" << (it->second) << "]\n" );
return it->second;
}
return fieldCanon(f);
@ -1031,8 +1016,7 @@ bool RclConfig::setMimeViewerAllEx(const string& allex)
string RclConfig::getMimeViewerDef(const string &mtype, const string& apptag,
bool useall) const
{
LOGDEB2(("RclConfig::getMimeViewerDef: mtype [%s] apptag [%s]\n",
mtype.c_str(), apptag.c_str()));
LOGDEB2("RclConfig::getMimeViewerDef: mtype [" << (mtype) << "] apptag [" << (apptag) << "]\n" );
string hs;
if (mimeview == 0)
return hs;
@ -1216,19 +1200,17 @@ string RclConfig::getPidfile() const
void RclConfig::urlrewrite(const string& dbdir, string& url) const
{
LOGDEB2(("RclConfig::urlrewrite: dbdir [%s] url [%s]\n",
dbdir.c_str(), url.c_str()));
LOGDEB2("RclConfig::urlrewrite: dbdir [" << (dbdir) << "] url [" << (url) << "]\n" );
// Do path translations exist for this index ?
if (m_ptrans == 0 || !m_ptrans->hasSubKey(dbdir)) {
LOGDEB2(("RclConfig::urlrewrite: no paths translations (m_ptrans %p)\n",
m_ptrans));
LOGDEB2("RclConfig::urlrewrite: no paths translations (m_ptrans " << (m_ptrans) << ")\n" );
return;
}
string path = fileurltolocalpath(url);
if (path.empty()) {
LOGDEB2(("RclConfig::urlrewrite: not file url\n"));
LOGDEB2("RclConfig::urlrewrite: not file url\n" );
return;
}
@ -1387,7 +1369,7 @@ bool RclConfig::getUncompressor(const string &mtype, vector<string>& cmd) const
vector<string> tokens;
stringToStrings(hs, tokens);
if (tokens.empty()) {
LOGERR(("getUncompressor: empty spec for mtype %s\n", mtype.c_str()));
LOGERR("getUncompressor: empty spec for mtype " << (mtype) << "\n" );
return false;
}
vector<string>::iterator it = tokens.begin();
@ -1405,7 +1387,7 @@ bool RclConfig::getUncompressor(const string &mtype, vector<string>& cmd) const
if (!stringlowercmp("python", *it) || !stringlowercmp("perl", *it)) {
it++;
if (tokens.size() < 3) {
LOGERR(("getUncpressor: python/perl cmd: no script?. [%s]\n", mtype.c_str()));
LOGERR("getUncpressor: python/perl cmd: no script?. [" << (mtype) << "]\n" );
} else {
*it = findFilter(*it);
}
@ -1552,7 +1534,8 @@ void RclConfig::initParamStale(ConfNull *cnf, ConfNull *mimemap)
using namespace std;
#include "debuglog.h"
#include "log.h"
#include "rclinit.h"
#include "rclconfig.h"
#include "cstr.h"
@ -1727,3 +1710,4 @@ int main(int argc, char **argv)
}
#endif // TEST_RCLCONFIG

View file

@ -315,7 +315,7 @@ class RclConfig {
string findFilter(const string& cmd) const;
/** Thread config init is not done automatically because not all
programs need it and it uses debuglog so that it's better to
programs need it and it uses the debug log so that it's better to
call it after primary init */
void initThrConf();

View file

@ -28,7 +28,7 @@
#include <string.h>
#endif
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "rclinit.h"
#include "pathut.h"
@ -60,7 +60,7 @@ static pthread_t mainthread_id;
static void siglogreopen(int)
{
if (recoll_ismainthread())
DebugLog::reopen();
Logger::getTheLog("")->reopen("");
}
// We would like to block SIGCHLD globally, but we can't because
@ -258,10 +258,7 @@ RclConfig *recollinit(RclInitFlags flags,
// to utf8 for indexing.
setlocale(LC_CTYPE, "");
DebugLog::getdbl()->setloglevel(DEBDEB1);
DebugLog::setfilename("stderr");
if (getenv("RECOLL_LOGDATE"))
DebugLog::getdbl()->logdate(1);
Logger::getTheLog("")->setLogLevel(Logger::LLDEB1);
initAsyncSigs(sigcleanup);
@ -298,14 +295,14 @@ RclConfig *recollinit(RclInitFlags flags,
logfilename = path_tildexpand(logfilename);
// If not an absolute path or , compute relative to config dir
if (!path_isabsolute(logfilename) &&
!DebugLog::DebugLog::isspecialname(logfilename.c_str())) {
logfilename.compare("stderr")) {
logfilename = path_cat(config->getConfDir(), logfilename);
}
DebugLog::setfilename(logfilename.c_str());
Logger::getTheLog("")->reopen(logfilename);
}
if (!loglevel.empty()) {
int lev = atoi(loglevel.c_str());
DebugLog::getdbl()->setloglevel(lev);
Logger::getTheLog("")->setLogLevel(Logger::LogLevel(lev));
}
// Make sure the locale charset is initialized (so that multiple

View file

@ -19,7 +19,7 @@
#include "syngroups.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include <errno.h>
@ -68,11 +68,11 @@ SynGroups::SynGroups()
bool SynGroups::setfile(const string& fn)
{
LOGDEB(("SynGroups::setfile(%s)\n", fn.c_str()));
LOGDEB("SynGroups::setfile(" << (fn) << ")\n" );
if (!m) {
m = new Internal;
if (!m) {
LOGERR(("SynGroups:setfile:: new Internal failed: no mem ?\n"));
LOGERR("SynGroups:setfile:: new Internal failed: no mem ?\n" );
return false;
}
}
@ -86,8 +86,7 @@ bool SynGroups::setfile(const string& fn)
ifstream input;
input.open(fn.c_str(), ios::in);
if (!input.is_open()) {
LOGERR(("SynGroups:setfile:: could not open %s errno %d\n",
fn.c_str(), errno));
LOGERR("SynGroups:setfile:: could not open " << (fn) << " errno " << (errno) << "\n" );
return false;
}
@ -102,8 +101,7 @@ bool SynGroups::setfile(const string& fn)
getline(input, cline);
if (!input.good()) {
if (input.bad()) {
LOGERR(("Syngroup::setfile(%s):Parse: input.bad()\n",
fn.c_str()));
LOGERR("Syngroup::setfile(" << (fn) << "):Parse: input.bad()\n" );
return false;
}
// Must be eof ? But maybe we have a partial line which
@ -144,16 +142,14 @@ bool SynGroups::setfile(const string& fn)
vector<string> words;
if (!stringToStrings(line, words)) {
LOGERR(("SynGroups:setfile: %s: bad line %d: %s\n",
fn.c_str(), lnum, line.c_str()));
LOGERR("SynGroups:setfile: " << (fn) << ": bad line " << (lnum) << ": " << (line) << "\n" );
continue;
}
if (words.empty())
continue;
if (words.size() == 1) {
LOGERR(("Syngroup::setfile(%s):single term group at line %d ??\n",
fn.c_str(), lnum));
LOGERR("Syngroup::setfile(" << (fn) << "):single term group at line " << (lnum) << " ??\n" );
continue;
}
@ -162,8 +158,7 @@ bool SynGroups::setfile(const string& fn)
it != words.end(); it++) {
m->terms[*it] = m->groups.size()-1;
}
LOGDEB1(("SynGroups::setfile: group: [%s]\n",
stringsToString(m->groups.back()).c_str()));
LOGDEB1("SynGroups::setfile: group: [" << (stringsToString(m->groups.back())) << "]\n" );
}
m->ok = true;
return true;
@ -178,14 +173,13 @@ vector<string> SynGroups::getgroup(const string& term)
STD_UNORDERED_MAP<string, unsigned int>::const_iterator it1 =
m->terms.find(term);
if (it1 == m->terms.end()) {
LOGDEB1(("SynGroups::getgroup: [%s] not found in direct map\n",
term.c_str()));
LOGDEB1("SynGroups::getgroup: [" << (term) << "] not found in direct map\n" );
return ret;
}
unsigned int idx = it1->second;
if (idx >= m->groups.size()) {
LOGERR(("SynGroups::getgroup: line index higher than line count !\n"));
LOGERR("SynGroups::getgroup: line index higher than line count !\n" );
return ret;
}
return m->groups[idx];
@ -194,7 +188,8 @@ vector<string> SynGroups::getgroup(const string& term)
#else
#include "syngroups.h"
#include "debuglog.h"
#include "log.h"
#include <string>
#include <iostream>
@ -252,3 +247,4 @@ int main(int argc, char **argv)
}
#endif

View file

@ -27,7 +27,7 @@
#include UNORDERED_SET_INCLUDE
#include "textsplit.h"
#include "debuglog.h"
#include "log.h"
//#define UTF8ITER_CHECK
#include "utf8iter.h"
#include "uproplist.h"
@ -221,7 +221,7 @@ bool TextSplit::o_deHyphenate = false;
inline bool TextSplit::emitterm(bool isspan, string &w, int pos,
size_t btstart, size_t btend)
{
LOGDEB2(("TextSplit::emitterm: [%s] pos %d\n", w.c_str(), pos));
LOGDEB2("TextSplit::emitterm: [" << (w) << "] pos " << (pos) << "\n" );
int l = int(w.length());
@ -252,7 +252,7 @@ inline bool TextSplit::emitterm(bool isspan, string &w, int pos,
m_prevlen = int(w.length());
return ret;
}
LOGDEB2(("TextSplit::emitterm:dup: [%s] pos %d\n", w.c_str(), pos));
LOGDEB2("TextSplit::emitterm:dup: [" << (w) << "] pos " << (pos) << "\n" );
}
return true;
}
@ -369,10 +369,7 @@ bool TextSplit::words_from_span(size_t bp)
inline bool TextSplit::doemit(bool spanerase, size_t _bp)
{
int bp = int(_bp);
LOGDEB2(("TextSplit::doemit: sper %d bp %d spp %d spanwords %u wS %d wL %d "
"inn %d span [%s]\n",
spanerase, bp, m_spanpos, m_words_in_span.size(),
m_wordStart, m_wordLen, m_inNumber, m_span.c_str()));
LOGDEB2("TextSplit::doemit: sper " << (spanerase) << " bp " << (bp) << " spp " << (m_spanpos) << " spanwords " << (m_words_in_span.size()) << " wS " << (m_wordStart) << " wL " << (m_wordLen) << " inn " << (m_inNumber) << " span [" << (m_span) << "]\n" );
if (m_wordLen) {
// We have a current word. Remember it
@ -468,12 +465,12 @@ static inline bool isdigit(int what, unsigned int flgs)
*/
bool TextSplit::text_to_words(const string &in)
{
LOGDEB1(("TextSplit::text_to_words: docjk %d (%d) %s%s%s [%s]\n",
o_processCJK, o_CJKNgramLen,
m_flags & TXTS_NOSPANS ? " nospans" : "",
m_flags & TXTS_ONLYSPANS ? " onlyspans" : "",
m_flags & TXTS_KEEPWILD ? " keepwild" : "",
in.substr(0,50).c_str()));
LOGDEB1("TextSplit::text_to_words: docjk " << o_processCJK << "(" <<
o_CJKNgramLen << ")" <<
(m_flags & TXTS_NOSPANS ? " nospans" : "") <<
(m_flags & TXTS_ONLYSPANS ? " onlyspans" : "") <<
(m_flags & TXTS_KEEPWILD ? " keepwild" : "") <<
"[" << in.substr(0,50) << "]\n");
if (in.empty())
return true;
@ -495,7 +492,7 @@ bool TextSplit::text_to_words(const string &in)
nonalnumcnt++;
if (c == (unsigned int)-1) {
LOGERR(("Textsplit: error occured while scanning UTF-8 string\n"));
LOGERR("Textsplit: error occured while scanning UTF-8 string\n" );
return false;
}
@ -509,7 +506,7 @@ bool TextSplit::text_to_words(const string &in)
// Hand off situation to the cjk routine.
if (!cjk_to_words(&it, &c)) {
LOGERR(("Textsplit: scan error in cjk handler\n"));
LOGERR("Textsplit: scan error in cjk handler\n" );
return false;
}
@ -805,7 +802,7 @@ bool TextSplit::text_to_words(const string &in)
// be better off converting the whole buffer to utf32 on entry...
bool TextSplit::cjk_to_words(Utf8Iter *itp, unsigned int *cp)
{
LOGDEB1(("cjk_to_words: m_wordpos %d\n", m_wordpos));
LOGDEB1("cjk_to_words: m_wordpos " << (m_wordpos) << "\n" );
Utf8Iter &it = *itp;
// We use an offset buffer to remember the starts of the utf-8
@ -908,9 +905,8 @@ bool TextSplit::hasVisibleWhite(const string &in)
Utf8Iter it(in);
for (; !it.eof(); it++) {
unsigned int c = (unsigned char)*it;
LOGDEB3(("TextSplit::hasVisibleWhite: testing 0x%04x\n", c));
if (c == (unsigned int)-1) {
LOGERR(("hasVisibleWhite: error while scanning UTF-8 string\n"));
LOGERR("hasVisibleWhite: error while scanning UTF-8 string\n" );
return false;
}
if (visiblewhite.find(c) != visiblewhite.end())
@ -931,10 +927,8 @@ template <class T> bool u8stringToStrings(const string &s, T &tokens)
unsigned int c = *it;
if (visiblewhite.find(c) != visiblewhite.end())
c = ' ';
LOGDEB3(("TextSplit::stringToStrings: 0x%04x\n", c));
if (c == (unsigned int)-1) {
LOGERR(("TextSplit::stringToStrings: error while "
"scanning UTF-8 string\n"));
LOGERR("TextSplit::stringToStrings: error while scanning UTF-8 string\n" );
return false;
}
@ -1011,7 +1005,8 @@ bool TextSplit::stringToStrings(const string &s, vector<string> &tokens)
#include "textsplit.h"
#include "readfile.h"
#include "debuglog.h"
#include "log.h"
#include "transcode.h"
#include "unacpp.h"
#include "termproc.h"
@ -1244,3 +1239,4 @@ int main(int argc, char **argv)
}
}
#endif // TEST

View file

@ -24,7 +24,7 @@
#include "unacpp.h"
#include "unac.h"
#include "debuglog.h"
#include "log.h"
#include "utf8iter.h"
bool unacmaybefold(const string &in, string &out,
@ -68,7 +68,7 @@ bool unacmaybefold(const string &in, string &out,
// testing user-entered terms, so we don't really care.
bool unaciscapital(const string& in)
{
LOGDEB2(("unaciscapital: [%s]\n", in.c_str()));
LOGDEB2("unaciscapital: [" << (in) << "]\n" );
if (in.empty())
return false;
Utf8Iter it(in);
@ -77,7 +77,7 @@ bool unaciscapital(const string& in)
string lower;
if (!unacmaybefold(shorter, lower, "UTF-8", UNACOP_FOLD)) {
LOGINFO(("unaciscapital: unac/fold failed for [%s]\n", in.c_str()));
LOGINFO("unaciscapital: unac/fold failed for [" << (in) << "]\n" );
return false;
}
Utf8Iter it1(lower);
@ -88,13 +88,13 @@ bool unaciscapital(const string& in)
}
bool unachasuppercase(const string& in)
{
LOGDEB2(("unachasuppercase: [%s]\n", in.c_str()));
LOGDEB2("unachasuppercase: [" << (in) << "]\n" );
if (in.empty())
return false;
string lower;
if (!unacmaybefold(in, lower, "UTF-8", UNACOP_FOLD)) {
LOGINFO(("unachasuppercase: unac/fold failed for [%s]\n", in.c_str()));
LOGINFO("unachasuppercase: unac/fold failed for [" << (in) << "]\n" );
return false;
}
if (lower != in)
@ -104,13 +104,13 @@ bool unachasuppercase(const string& in)
}
bool unachasaccents(const string& in)
{
LOGDEB2(("unachasaccents: [%s]\n", in.c_str()));
LOGDEB2("unachasaccents: [" << (in) << "]\n" );
if (in.empty())
return false;
string noac;
if (!unacmaybefold(in, noac, "UTF-8", UNACOP_UNAC)) {
LOGINFO(("unachasaccents: unac/unac failed for [%s]\n", in.c_str()));
LOGINFO("unachasaccents: unac/unac failed for [" << (in) << "]\n" );
return false;
}
if (noac != in)
@ -247,3 +247,4 @@ int main(int argc, char **argv)
}
#endif

View file

@ -24,7 +24,7 @@
#include "cstr.h"
#include "pathut.h"
#include "rclutil.h"
#include "debuglog.h"
#include "log.h"
#include "fstreewalk.h"
#include "beaglequeue.h"
#include "beaglequeuecache.h"
@ -62,7 +62,7 @@ public:
m_input.getline(cline, LL-1);
if (!m_input.good()) {
if (m_input.bad()) {
LOGERR(("beagleDotFileRead: input.bad()\n"));
LOGERR("beagleDotFileRead: input.bad()\n" );
}
return false;
}
@ -72,7 +72,7 @@ public:
ll--;
}
line.assign(cline, ll);
LOGDEB2(("BeagleDotFile:readLine: [%s]\n", line.c_str()));
LOGDEB2("BeagleDotFile:readLine: [" << (line) << "]\n" );
return true;
}
@ -83,7 +83,7 @@ public:
m_input.open(m_fn.c_str(), ios::in);
if (!m_input.good()) {
LOGERR(("BeagleDotFile: open failed for [%s]\n", m_fn.c_str()));
LOGERR("BeagleDotFile: open failed for [" << (m_fn) << "]\n" );
return false;
}
@ -185,7 +185,7 @@ BeagleQueueIndexer::BeagleQueueIndexer(RclConfig *cnf, Rcl::Db *db,
BeagleQueueIndexer::~BeagleQueueIndexer()
{
LOGDEB(("BeagleQueueIndexer::~\n"));
LOGDEB("BeagleQueueIndexer::~\n" );
deleteZ(m_cache);
}
@ -202,12 +202,12 @@ bool BeagleQueueIndexer::indexFromCache(const string& udi)
string hittype;
if (!m_cache || !m_cache->getFromCache(udi, dotdoc, data, &hittype)) {
LOGERR(("BeagleQueueIndexer::indexFromCache: cache failed\n"));
LOGERR("BeagleQueueIndexer::indexFromCache: cache failed\n" );
return false;
}
if (hittype.empty()) {
LOGERR(("BeagleIndexer::index: cc entry has no hit type\n"));
LOGERR("BeagleIndexer::index: cc entry has no hit type\n" );
return false;
}
@ -224,11 +224,11 @@ bool BeagleQueueIndexer::indexFromCache(const string& udi)
try {
fis = interner.internfile(doc);
} catch (CancelExcept) {
LOGERR(("BeagleQueueIndexer: interrupted\n"));
LOGERR("BeagleQueueIndexer: interrupted\n" );
return false;
}
if (fis != FileInterner::FIDone) {
LOGERR(("BeagleQueueIndexer: bad status from internfile\n"));
LOGERR("BeagleQueueIndexer: bad status from internfile\n" );
return false;
}
@ -257,15 +257,14 @@ bool BeagleQueueIndexer::index()
{
if (!m_db)
return false;
LOGDEB(("BeagleQueueIndexer::processqueue: [%s]\n", m_queuedir.c_str()));
LOGDEB("BeagleQueueIndexer::processqueue: [" << (m_queuedir) << "]\n" );
m_config->setKeyDir(m_queuedir);
if (!path_makepath(m_queuedir, 0700)) {
LOGERR(("BeagleQueueIndexer:: can't create queuedir [%s] errno %d\n",
m_queuedir.c_str(), errno));
LOGERR("BeagleQueueIndexer:: can't create queuedir [" << (m_queuedir) << "] errno " << (errno) << "\n" );
return false;
}
if (!m_cache || !m_cache->cc()) {
LOGERR(("BeagleQueueIndexer: cache initialization failed\n"));
LOGERR("BeagleQueueIndexer: cache initialization failed\n" );
return false;
}
CirCache *cc = m_cache->cc();
@ -283,7 +282,7 @@ bool BeagleQueueIndexer::index()
do {
string udi;
if (!cc->getCurrentUdi(udi)) {
LOGERR(("BeagleQueueIndexer:: cache file damaged\n"));
LOGERR("BeagleQueueIndexer:: cache file damaged\n" );
break;
}
if (udi.empty())
@ -296,7 +295,7 @@ bool BeagleQueueIndexer::index()
indexFromCache(udi);
updstatus(udi);
} catch (CancelExcept) {
LOGERR(("BeagleQueueIndexer: interrupted\n"));
LOGERR("BeagleQueueIndexer: interrupted\n" );
return false;
}
}
@ -308,17 +307,17 @@ bool BeagleQueueIndexer::index()
FsTreeWalker walker(FsTreeWalker::FtwNoRecurse);
walker.addSkippedName(".*");
FsTreeWalker::Status status = walker.walk(m_queuedir, *this);
LOGDEB(("BeagleQueueIndexer::processqueue: done: status %d\n", status));
LOGDEB("BeagleQueueIndexer::processqueue: done: status " << (status) << "\n" );
return true;
}
// Index a list of files (sent by the real time monitor)
bool BeagleQueueIndexer::indexFiles(list<string>& files)
{
LOGDEB(("BeagleQueueIndexer::indexFiles\n"));
LOGDEB("BeagleQueueIndexer::indexFiles\n" );
if (!m_db) {
LOGERR(("BeagleQueueIndexer::indexfiles no db??\n"));
LOGERR("BeagleQueueIndexer::indexfiles no db??\n" );
return false;
}
for (list<string>::iterator it = files.begin(); it != files.end();) {
@ -327,8 +326,7 @@ bool BeagleQueueIndexer::indexFiles(list<string>& files)
}
string father = path_getfather(*it);
if (father.compare(m_queuedir)) {
LOGDEB(("BeagleQueueIndexer::indexfiles: skipping [%s] (nq)\n",
it->c_str()));
LOGDEB("BeagleQueueIndexer::indexfiles: skipping [" << *it << "] (nq)\n" );
it++; continue;
}
// Pb: we are often called with the dot file, before the
@ -344,13 +342,11 @@ bool BeagleQueueIndexer::indexFiles(list<string>& files)
}
struct stat st;
if (path_fileprops(*it, &st) != 0) {
LOGERR(("BeagleQueueIndexer::indexfiles: cant stat [%s]\n",
it->c_str()));
LOGERR("BeagleQueueIndexer::indexfiles: cant stat [" << *it << "]\n" );
it++; continue;
}
if (!S_ISREG(st.st_mode)) {
LOGDEB(("BeagleQueueIndexer::indexfiles: skipping [%s] (nr)\n",
it->c_str()));
LOGDEB("BeagleQueueIndexer::indexfiles: skipping [" << *it << "] (nr)\n" );
it++; continue;
}
@ -378,7 +374,7 @@ BeagleQueueIndexer::processone(const string &path,
string dotpath = path_cat(path_getfather(path),
string(".") + path_getsimple(path));
LOGDEB(("BeagleQueueIndexer: prc1: [%s]\n", path.c_str()));
LOGDEB("BeagleQueueIndexer: prc1: [" << (path) << "]\n" );
BeagleDotFile dotfile(m_config, dotpath);
Rcl::Doc dotdoc;
@ -392,7 +388,7 @@ BeagleQueueIndexer::processone(const string &path,
udipath = path_cat(dotdoc.meta[Rcl::Doc::keybght], url_gpath(dotdoc.url));
make_udi(udipath, cstr_null, udi);
LOGDEB(("BeagleQueueIndexer: prc1: udi [%s]\n", udi.c_str()));
LOGDEB("BeagleQueueIndexer: prc1: udi [" << (udi) << "]\n" );
char ascdate[30];
sprintf(ascdate, "%ld", long(stp->st_mtime));
@ -424,11 +420,11 @@ BeagleQueueIndexer::processone(const string &path,
try {
fis = interner.internfile(doc);
} catch (CancelExcept) {
LOGERR(("BeagleQueueIndexer: interrupted\n"));
LOGERR("BeagleQueueIndexer: interrupted\n" );
goto out;
}
if (fis != FileInterner::FIDone && fis != FileInterner::FIAgain) {
LOGERR(("BeagleQueueIndexer: bad status from internfile\n"));
LOGERR("BeagleQueueIndexer: bad status from internfile\n" );
// TOBEDONE: internfile can return FIAgain here if it is
// paging a big text file, we should loop. Means we're
// only indexing the first page for text/plain files
@ -461,12 +457,11 @@ BeagleQueueIndexer::processone(const string &path,
string fdata;
file_to_string(path, fdata);
if (!m_cache || !m_cache->cc()) {
LOGERR(("BeagleQueueIndexer: cache initialization failed\n"));
LOGERR("BeagleQueueIndexer: cache initialization failed\n" );
goto out;
}
if (!m_cache->cc()->put(udi, &dotfile.m_fields, fdata, 0)) {
LOGERR(("BeagleQueueIndexer::prc1: cache_put failed; %s\n",
m_cache->cc()->getReason().c_str()));
LOGERR("BeagleQueueIndexer::prc1: cache_put failed; " << (m_cache->cc()->getReason()) << "\n" );
goto out;
}
}
@ -479,3 +474,4 @@ out:
}
return FsTreeWalker::FtwOk;
}

View file

@ -16,11 +16,10 @@
*/
#include "autoconfig.h"
#include "debuglog.h"
#include "rcldoc.h"
#include "fetcher.h"
#include "bglfetcher.h"
#include "debuglog.h"
#include "log.h"
#include "ptmutex.h"
#include "beaglequeuecache.h"
@ -32,7 +31,7 @@ bool BGLDocFetcher::fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out)
{
string udi;
if (!idoc.getmeta(Rcl::Doc::keyudi, &udi) || udi.empty()) {
LOGERR(("BGLDocFetcher:: no udi in idoc\n"));
LOGERR("BGLDocFetcher:: no udi in idoc\n" );
return false;
}
Rcl::Doc dotdoc;
@ -43,13 +42,12 @@ bool BGLDocFetcher::fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out)
// deleted when the program exits.
static BeagleQueueCache o_beagler(cnf);
if (!o_beagler.getFromCache(udi, dotdoc, out.data)) {
LOGINFO(("BGLDocFetcher::fetch: failed for [%s]\n", udi.c_str()));
LOGINFO("BGLDocFetcher::fetch: failed for [" << (udi) << "]\n" );
return false;
}
}
if (dotdoc.mimetype.compare(idoc.mimetype)) {
LOGINFO(("BGLDocFetcher:: udi [%s], mimetp mismatch: in: [%s], bgl "
"[%s]\n", idoc.mimetype.c_str(), dotdoc.mimetype.c_str()));
LOGINFO("BGLDocFetcher:: udi [" << (udi) << "], mimetp mismatch: in: [" << (idoc.mimetype) << "], bgl [" << (dotdoc.mimetype) << "]\n" );
}
out.kind = RawDoc::RDK_DATA;
return true;
@ -62,3 +60,4 @@ bool BGLDocFetcher::makesig(RclConfig* cnf, const Rcl::Doc& idoc, string& sig)
return true;
}

View file

@ -21,7 +21,7 @@
#include "rclconfig.h"
#include "execmd.h"
#include "debuglog.h"
#include "log.h"
#include "checkretryfailed.h"
using namespace std;
@ -34,8 +34,7 @@ bool checkRetryFailed(RclConfig *conf, bool record)
string cmd;
if (!conf->getConfParam("checkneedretryindexscript", cmd)) {
LOGDEB(("checkRetryFailed: 'checkneedretryindexscript' "
"not set in config\n"));
LOGDEB("checkRetryFailed: 'checkneedretryindexscript' not set in config\n" );
// We could toss a dice ? Say no retry in this case.
return false;
}
@ -56,3 +55,4 @@ bool checkRetryFailed(RclConfig *conf, bool record)
return false;
#endif
}

View file

@ -22,7 +22,7 @@
#include "exefetcher.h"
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include "rclconfig.h"
#include "execmd.h"
@ -47,12 +47,10 @@ public:
args.push_back(idoc.ipath);
int status = ecmd.doexec1(args, 0, &out);
if (status == 0) {
LOGDEB(("EXEDocFetcher::Internal: got [%s]\n", out.c_str()));
LOGDEB("EXEDocFetcher::Internal: got [" << (out) << "]\n" );
return true;
} else {
LOGERR(("EXEDOcFetcher::fetch: %s: %s failed for %s %s %s 0x%u\n",
bckid.c_str(), stringsToString(cmd).c_str(), udi.c_str(),
idoc.url.c_str(), idoc.ipath.c_str()));
LOGERR("EXEDOcFetcher::fetch: " << (bckid) << ": " << (stringsToString(cmd)) << " failed for " << (udi) << " " << (idoc.url) << " " << (idoc.ipath) << "\n" );
return false;
}
}
@ -61,8 +59,7 @@ public:
EXEDocFetcher::EXEDocFetcher(const EXEDocFetcher::Internal& _m)
{
m = new Internal(_m);
LOGDEB(("EXEDocFetcher::EXEDocFetcher: fetch is %s\n",
stringsToString(m->sfetch).c_str()));
LOGDEB("EXEDocFetcher::EXEDocFetcher: fetch is " << (stringsToString(m->sfetch)) << "\n" );
}
bool EXEDocFetcher::fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out)
@ -85,13 +82,12 @@ EXEDocFetcher *exeDocFetcherMake(RclConfig *config, const string& bckid)
static ConfSimple *bconf;
if (!bconf) {
string bconfname = path_cat(config->getConfDir(), "backends");
LOGDEB(("exeDocFetcherMake: using config in %s\n", bconfname.c_str()));
LOGDEB("exeDocFetcherMake: using config in " << (bconfname) << "\n" );
bconf = new ConfSimple(bconfname.c_str(), true);
if (!bconf->ok()) {
delete bconf;
bconf = 0;
LOGDEB(("exeDocFetcherMake: bad/no config: %s\n",
bconfname.c_str()));
LOGDEB("exeDocFetcherMake: bad/no config: " << (bconfname) << "\n" );
return 0;
}
}
@ -101,29 +97,28 @@ EXEDocFetcher *exeDocFetcherMake(RclConfig *config, const string& bckid)
string sfetch;
if (!bconf->get("fetch", sfetch, bckid) || sfetch.empty()) {
LOGERR(("exeDocFetcherMake: no 'fetch' for [%s]\n", bckid.c_str()));
LOGERR("exeDocFetcherMake: no 'fetch' for [" << (bckid) << "]\n" );
return 0;
}
stringToStrings(sfetch, m.sfetch);
// We look up the command as we do for filters for now
m.sfetch[0] = config->findFilter(m.sfetch[0]);
if (!path_isabsolute(m.sfetch[0])) {
LOGERR(("exeDocFetcherMake: %s not found in exec path or filters dir\n",
m.sfetch[0].c_str()));
LOGERR("exeDocFetcherMake: " << (m.sfetch[0]) << " not found in exec path or filters dir\n" );
return 0;
}
string smkid;
if (!bconf->get("makesig", smkid, bckid) || smkid.empty()) {
LOGDEB(("exeDocFetcherMake: no 'makesig' for [%s]\n", bckid.c_str()));
LOGDEB("exeDocFetcherMake: no 'makesig' for [" << (bckid) << "]\n" );
return 0;
}
stringToStrings(smkid, m.smkid);
m.smkid[0] = config->findFilter(m.smkid[0]);
if (!path_isabsolute(m.smkid[0])) {
LOGERR(("exeDocFetcherMake: %s not found in exec path or filters dir\n",
m.smkid[0].c_str()));
LOGERR("exeDocFetcherMake: " << (m.smkid[0]) << " not found in exec path or filters dir\n" );
return 0;
}
return new EXEDocFetcher(m);
}

View file

@ -17,7 +17,7 @@
#include "autoconfig.h"
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "fetcher.h"
@ -28,7 +28,7 @@
DocFetcher *docFetcherMake(RclConfig *config, const Rcl::Doc& idoc)
{
if (idoc.url.empty()) {
LOGERR(("docFetcherMakeg:: no url in doc!\n"));
LOGERR("docFetcherMakeg:: no url in doc!\n" );
return 0;
}
string backend;
@ -42,9 +42,9 @@ DocFetcher *docFetcherMake(RclConfig *config, const Rcl::Doc& idoc)
} else {
DocFetcher *f = exeDocFetcherMake(config, backend);
if (!f) {
LOGERR(("DocFetcherFactory: unknown backend [%s]\n",
backend.c_str()));
LOGERR("DocFetcherFactory: unknown backend [" << (backend) << "]\n" );
}
return f;
}
}

View file

@ -19,12 +19,11 @@
#include <errno.h>
#include "safesysstat.h"
#include "debuglog.h"
#include "log.h"
#include "cstr.h"
#include "fetcher.h"
#include "fsfetcher.h"
#include "fsindexer.h"
#include "debuglog.h"
#include "pathut.h"
using std::string;
@ -35,8 +34,7 @@ static bool urltopath(RclConfig* cnf,
// The url has to be like file://
fn = fileurltolocalpath(idoc.url);
if (fn.empty()) {
LOGERR(("FSDocFetcher::fetch/sig: non fs url: [%s]\n",
idoc.url.c_str()));
LOGERR("FSDocFetcher::fetch/sig: non fs url: [" << (idoc.url) << "]\n" );
return false;
}
cnf->setKeyDir(path_getfather(fn));
@ -44,8 +42,7 @@ static bool urltopath(RclConfig* cnf,
cnf->getConfParam("followLinks", &follow);
if (path_fileprops(fn, &st, follow) < 0) {
LOGERR(("FSDocFetcher::fetch: stat errno %d for [%s]\n",
errno, fn.c_str()));
LOGERR("FSDocFetcher::fetch: stat errno " << (errno) << " for [" << (fn) << "]\n" );
return false;
}
return true;
@ -71,3 +68,4 @@ bool FSDocFetcher::makesig(RclConfig* cnf, const Rcl::Doc& idoc, string& sig)
return true;
}

View file

@ -37,7 +37,7 @@
#include "indexer.h"
#include "fsindexer.h"
#include "transcode.h"
#include "debuglog.h"
#include "log.h"
#include "internfile.h"
#include "smallut.h"
#include "chrono.h"
@ -106,19 +106,18 @@ FsIndexer::FsIndexer(RclConfig *cnf, Rcl::Db *db, DbIxStatusUpdater *updfunc)
m_dwqueue("Split", cnf->getThrConf(RclConfig::ThrSplit).first)
#endif // IDX_THREADS
{
LOGDEB1(("FsIndexer::FsIndexer\n"));
LOGDEB1("FsIndexer::FsIndexer\n" );
m_havelocalfields = m_config->hasNameAnywhere("localfields");
m_config->getConfParam("detectxattronly", &m_detectxattronly);
#ifdef IDX_THREADS
m_stableconfig = new RclConfig(*m_config);
m_loglevel = DebugLog::getdbl()->getlevel();
m_haveInternQ = m_haveSplitQ = false;
int internqlen = cnf->getThrConf(RclConfig::ThrIntern).first;
int internthreads = cnf->getThrConf(RclConfig::ThrIntern).second;
if (internqlen >= 0) {
if (!m_iwqueue.start(internthreads, FsIndexerInternfileWorker, this)) {
LOGERR(("FsIndexer::FsIndexer: intern worker start failed\n"));
LOGERR("FsIndexer::FsIndexer: intern worker start failed\n" );
return;
}
m_haveInternQ = true;
@ -127,30 +126,28 @@ FsIndexer::FsIndexer(RclConfig *cnf, Rcl::Db *db, DbIxStatusUpdater *updfunc)
int splitthreads = cnf->getThrConf(RclConfig::ThrSplit).second;
if (splitqlen >= 0) {
if (!m_dwqueue.start(splitthreads, FsIndexerDbUpdWorker, this)) {
LOGERR(("FsIndexer::FsIndexer: split worker start failed\n"));
LOGERR("FsIndexer::FsIndexer: split worker start failed\n" );
return;
}
m_haveSplitQ = true;
}
LOGDEB(("FsIndexer: threads: haveIQ %d iql %d iqts %d "
"haveSQ %d sql %d sqts %d\n", m_haveInternQ, internqlen,
internthreads, m_haveSplitQ, splitqlen, splitthreads));
LOGDEB("FsIndexer: threads: haveIQ " << (m_haveInternQ) << " iql " << (internqlen) << " iqts " << (internthreads) << " haveSQ " << (m_haveSplitQ) << " sql " << (splitqlen) << " sqts " << (splitthreads) << "\n" );
#endif // IDX_THREADS
}
FsIndexer::~FsIndexer()
{
LOGDEB1(("FsIndexer::~FsIndexer()\n"));
LOGDEB1("FsIndexer::~FsIndexer()\n" );
#ifdef IDX_THREADS
void *status;
if (m_haveInternQ) {
status = m_iwqueue.setTerminateAndWait();
LOGDEB0(("FsIndexer: internfile wrkr status: %p (1->ok)\n", status));
LOGDEB0("FsIndexer: internfile wrkr status: " << (status) << " (1->ok)\n" );
}
if (m_haveSplitQ) {
status = m_dwqueue.setTerminateAndWait();
LOGDEB0(("FsIndexer: dbupd worker status: %p (1->ok)\n", status));
LOGDEB0("FsIndexer: dbupd worker status: " << (status) << " (1->ok)\n" );
}
delete m_stableconfig;
#endif // IDX_THREADS
@ -163,7 +160,7 @@ bool FsIndexer::init()
if (m_tdl.empty()) {
m_tdl = m_config->getTopdirs();
if (m_tdl.empty()) {
LOGERR(("FsIndexers: no topdirs list defined\n"));
LOGERR("FsIndexers: no topdirs list defined\n" );
return false;
}
}
@ -194,8 +191,8 @@ bool FsIndexer::index(int flags)
for (vector<string>::const_iterator it = m_tdl.begin();
it != m_tdl.end(); it++) {
LOGDEB(("FsIndexer::index: Indexing %s into %s\n", it->c_str(),
getDbDir().c_str()));
LOGDEB("FsIndexer::index: Indexing " << *it << " into " <<
getDbDir() << "\n");
// Set the current directory in config so that subsequent
// getConfParams() will get local values
@ -217,8 +214,8 @@ bool FsIndexer::index(int flags)
// Walk the directory tree
if (m_walker.walk(*it, *this) != FsTreeWalker::FtwOk) {
LOGERR(("FsIndexer::index: error while indexing %s: %s\n",
it->c_str(), m_walker.getReason().c_str()));
LOGERR("FsIndexer::index: error while indexing " << *it <<
": " << m_walker.getReason() << "\n");
return false;
}
}
@ -235,12 +232,11 @@ bool FsIndexer::index(int flags)
string missing;
m_missing->getMissingDescription(missing);
if (!missing.empty()) {
LOGINFO(("FsIndexer::index missing helper program(s):\n%s\n",
missing.c_str()));
LOGINFO("FsIndexer::index missing helper program(s):\n" << (missing) << "\n" );
}
m_config->storeMissingHelperDesc(missing);
}
LOGINFO(("fsindexer index time: %d mS\n", chron.millis()));
LOGINFO("fsindexer index time: " << (chron.millis()) << " mS\n" );
return true;
}
@ -261,8 +257,7 @@ static bool matchesSkipped(const vector<string>& tdl,
for (vector<string>::const_iterator it = tdl.begin();
it != tdl.end(); it++) {
// the topdirs members are already canonized.
LOGDEB2(("matchesSkipped: comparing ancestor [%s] to "
"topdir [%s]\n", mpath.c_str(), it->c_str()));
LOGDEB2("matchesSkipped: comparing ancestor [" << (mpath) << "] to topdir [" << (it) << "]\n" );
if (!mpath.compare(*it)) {
topdir = *it;
goto goodpath;
@ -270,8 +265,7 @@ static bool matchesSkipped(const vector<string>& tdl,
}
if (walker.inSkippedPaths(mpath, false)) {
LOGDEB(("FsIndexer::indexFiles: skipping [%s] (skpp)\n",
path.c_str()));
LOGDEB("FsIndexer::indexFiles: skipping [" << (path) << "] (skpp)\n" );
return true;
}
@ -285,13 +279,12 @@ static bool matchesSkipped(const vector<string>& tdl,
// path did not shorten, something is seriously amiss
// (could be an assert actually)
if (mpath.length() >= len) {
LOGERR(("FsIndexer::indexFile: internal Error: path [%s] did not "
"shorten\n", mpath.c_str()));
LOGERR("FsIndexer::indexFile: internal Error: path [" << (mpath) << "] did not shorten\n" );
return true;
}
}
// We get there if neither topdirs nor skippedPaths tests matched
LOGDEB(("FsIndexer::indexFiles: skipping [%s] (ntd)\n", path.c_str()));
LOGDEB("FsIndexer::indexFiles: skipping [" << (path) << "] (ntd)\n" );
return true;
goodpath:
@ -301,8 +294,7 @@ goodpath:
while (mpath.length() >= topdir.length() && mpath.length() > 1) {
string fn = path_getsimple(mpath);
if (walker.inSkippedNames(fn)) {
LOGDEB(("FsIndexer::indexFiles: skipping [%s] (skpn)\n",
path.c_str()));
LOGDEB("FsIndexer::indexFiles: skipping [" << (path) << "] (skpn)\n" );
return true;
}
@ -326,7 +318,7 @@ goodpath:
*/
bool FsIndexer::indexFiles(list<string>& files, int flags)
{
LOGDEB(("FsIndexer::indexFiles\n"));
LOGDEB("FsIndexer::indexFiles\n" );
m_noretryfailed = (flags & ConfIndexer::IxFNoRetryFailed) != 0;
bool ret = false;
@ -344,7 +336,7 @@ bool FsIndexer::indexFiles(list<string>& files, int flags)
walker.setSkippedPaths(m_config->getSkippedPaths());
for (list<string>::iterator it = files.begin(); it != files.end(); ) {
LOGDEB2(("FsIndexer::indexFiles: [%s]\n", it->c_str()));
LOGDEB2("FsIndexer::indexFiles: [" << (it) << "]\n" );
m_config->setKeyDir(path_getfather(*it));
if (m_havelocalfields)
@ -364,15 +356,15 @@ bool FsIndexer::indexFiles(list<string>& files, int flags)
struct stat stb;
int ststat = path_fileprops(*it, &stb, follow);
if (ststat != 0) {
LOGERR(("FsIndexer::indexFiles: (l)stat %s: %s", it->c_str(),
strerror(errno)));
LOGERR("FsIndexer::indexFiles: (l)stat " << *it << ": " <<
strerror(errno) << "\n");
it++;
continue;
}
if (processone(*it, &stb, FsTreeWalker::FtwRegular) !=
FsTreeWalker::FtwOk) {
LOGERR(("FsIndexer::indexFiles: processone failed\n"));
LOGERR("FsIndexer::indexFiles: processone failed\n" );
goto out;
}
it = files.erase(it);
@ -390,11 +382,11 @@ out:
// Purge possible orphan documents
if (ret == true) {
LOGDEB(("Indexfiles: purging orphans\n"));
LOGDEB("Indexfiles: purging orphans\n" );
const vector<string>& purgecandidates = m_purgeCandidates.getCandidates();
for (vector<string>::const_iterator it = purgecandidates.begin();
it != purgecandidates.end(); it++) {
LOGDEB(("Indexfiles: purging orphans for %s\n", it->c_str()));
LOGDEB("Indexfiles: purging orphans for " << *it << "\n");
m_db->purgeOrphans(*it);
}
#ifdef IDX_THREADS
@ -402,7 +394,7 @@ out:
#endif // IDX_THREADS
}
LOGDEB(("FsIndexer::indexFiles: done\n"));
LOGDEB("FsIndexer::indexFiles: done\n" );
return ret;
}
@ -410,7 +402,7 @@ out:
/** Purge docs for given files out of the database */
bool FsIndexer::purgeFiles(list<string>& files)
{
LOGDEB(("FsIndexer::purgeFiles\n"));
LOGDEB("FsIndexer::purgeFiles\n" );
bool ret = false;
if (!init())
return false;
@ -422,7 +414,7 @@ bool FsIndexer::purgeFiles(list<string>& files)
// found or deleted, false only in case of actual error
bool existed;
if (!m_db->purgeFile(udi, &existed)) {
LOGERR(("FsIndexer::purgeFiles: Database error\n"));
LOGERR("FsIndexer::purgeFiles: Database error\n" );
goto out;
}
// If we actually deleted something, take it off the list
@ -442,14 +434,14 @@ out:
m_dwqueue.waitIdle();
m_db->waitUpdIdle();
#endif // IDX_THREADS
LOGDEB(("FsIndexer::purgeFiles: done\n"));
LOGDEB("FsIndexer::purgeFiles: done\n" );
return ret;
}
// Local fields can be set for fs subtrees in the configuration file
void FsIndexer::localfieldsfromconf()
{
LOGDEB1(("FsIndexer::localfieldsfromconf\n"));
LOGDEB1("FsIndexer::localfieldsfromconf\n" );
string sfields;
m_config->getConfParam("localfields", sfields);
@ -469,8 +461,7 @@ void FsIndexer::localfieldsfromconf()
it != nmlst.end(); it++) {
string nm = m_config->fieldCanon(*it);
attrs.get(*it, m_localfields[nm]);
LOGDEB2(("FsIndexer::localfieldsfromconf: [%s]->[%s]\n",
nm.c_str(), m_localfields[nm].c_str()));
LOGDEB2("FsIndexer::localfieldsfromconf: [" << (nm) << "]->[" << (m_localfields[nm]) << "]\n" );
}
}
@ -501,7 +492,6 @@ void *FsIndexerDbUpdWorker(void * fsp)
recoll_threadinit();
FsIndexer *fip = (FsIndexer*)fsp;
WorkQueue<DbUpdTask*> *tqp = &fip->m_dwqueue;
DebugLog::getdbl()->setloglevel(fip->m_loglevel);
DbUpdTask *tsk;
for (;;) {
@ -510,9 +500,9 @@ void *FsIndexerDbUpdWorker(void * fsp)
tqp->workerExit();
return (void*)1;
}
LOGDEB0(("FsIndexerDbUpdWorker: task ql %d\n", int(qsz)));
LOGDEB0("FsIndexerDbUpdWorker: task ql " << (int(qsz)) << "\n" );
if (!fip->m_db->addOrUpdate(tsk->udi, tsk->parent_udi, tsk->doc)) {
LOGERR(("FsIndexerDbUpdWorker: addOrUpdate failed\n"));
LOGERR("FsIndexerDbUpdWorker: addOrUpdate failed\n" );
tqp->workerExit();
return (void*)0;
}
@ -525,7 +515,6 @@ void *FsIndexerInternfileWorker(void * fsp)
recoll_threadinit();
FsIndexer *fip = (FsIndexer*)fsp;
WorkQueue<InternfileTask*> *tqp = &fip->m_iwqueue;
DebugLog::getdbl()->setloglevel(fip->m_loglevel);
RclConfig myconf(*(fip->m_stableconfig));
InternfileTask *tsk = 0;
@ -534,15 +523,15 @@ void *FsIndexerInternfileWorker(void * fsp)
tqp->workerExit();
return (void*)1;
}
LOGDEB0(("FsIndexerInternfileWorker: task fn %s\n", tsk->fn.c_str()));
LOGDEB0("FsIndexerInternfileWorker: task fn " << (tsk->fn) << "\n" );
if (fip->processonefile(&myconf, tsk->fn, &tsk->statbuf,
tsk->localfields) !=
FsTreeWalker::FtwOk) {
LOGERR(("FsIndexerInternfileWorker: processone failed\n"));
LOGERR("FsIndexerInternfileWorker: processone failed\n" );
tqp->workerExit();
return (void*)0;
}
LOGDEB1(("FsIndexerInternfileWorker: done fn %s\n", tsk->fn.c_str()));
LOGDEB1("FsIndexerInternfileWorker: done fn " << (tsk->fn) << "\n" );
delete tsk;
}
}
@ -613,15 +602,11 @@ static string compute_utf8fn(RclConfig *config, const string& fn)
string utf8fn;
int ercnt;
if (!transcode(path_getsimple(fn), utf8fn, charset, "UTF-8", &ercnt)) {
LOGERR(("processone: fn transcode failure from [%s] to UTF-8: %s\n",
charset.c_str(), path_getsimple(fn).c_str()));
LOGERR("processone: fn transcode failure from [" << (charset) << "] to UTF-8: " << (path_getsimple(fn)) << "\n" );
} else if (ercnt) {
LOGDEB(("processone: fn transcode %d errors from [%s] to UTF-8: %s\n",
ercnt, charset.c_str(), path_getsimple(fn).c_str()));
LOGDEB("processone: fn transcode " << (ercnt) << " errors from [" << (charset) << "] to UTF-8: " << (path_getsimple(fn)) << "\n" );
}
LOGDEB2(("processone: fn transcoded from [%s] to [%s] (%s->%s)\n",
path_getsimple(fn).c_str(), utf8fn.c_str(), charset.c_str(),
"UTF-8"));
LOGDEB2("processone: fn transcoded from [" << (path_getsimple(fn)) << "] to [" << (utf8fn) << "] (" << (charset) << "->" << ("UTF-8") << ")\n" );
return utf8fn;
}
@ -663,8 +648,7 @@ FsIndexer::processonefile(RclConfig *config,
bool xattronly = m_detectxattronly && !m_db->inFullReset() &&
existingDoc && needupdate && (stp->st_mtime < stp->st_ctime);
LOGDEB(("processone: needupdate %d noretry %d existing %d oldsig [%s]\n",
needupdate, m_noretryfailed, existingDoc, oldsig.c_str()));
LOGDEB("processone: needupdate " << (needupdate) << " noretry " << (m_noretryfailed) << " existing " << (existingDoc) << " oldsig [" << (oldsig) << "]\n" );
// If noretryfailed is set, check for a file which previously
// failed to index, and avoid re-processing it
@ -674,14 +658,14 @@ FsIndexer::processonefile(RclConfig *config,
// actually changed, we always retry (maybe it was fixed)
string nold = oldsig.substr(0, oldsig.size()-1);
if (!nold.compare(sig)) {
LOGDEB(("processone: not retrying previously failed file\n"));
LOGDEB("processone: not retrying previously failed file\n" );
m_db->setExistingFlags(udi, existingDoc);
needupdate = false;
}
}
if (!needupdate) {
LOGDEB0(("processone: up to date: %s\n", fn.c_str()));
LOGDEB0("processone: up to date: " << (fn) << "\n" );
if (m_updater) {
#ifdef IDX_THREADS
PTMutexLocker locker(m_updater->m_mutex);
@ -696,8 +680,7 @@ FsIndexer::processonefile(RclConfig *config,
return FsTreeWalker::FtwOk;
}
LOGDEB0(("processone: processing: [%s] %s\n",
displayableBytes(off_t(stp->st_size)).c_str(), fn.c_str()));
LOGDEB0("processone: processing: [" << (displayableBytes(off_t(stp->st_size))) << "] " << (fn) << "\n" );
string utf8fn = compute_utf8fn(config, fn);
@ -729,7 +712,7 @@ FsIndexer::processonefile(RclConfig *config,
try {
fis = interner.internfile(doc);
} catch (CancelExcept) {
LOGERR(("fsIndexer::processone: interrupted\n"));
LOGERR("fsIndexer::processone: interrupted\n" );
return FsTreeWalker::FtwStop;
}
@ -800,7 +783,7 @@ FsIndexer::processonefile(RclConfig *config,
DbUpdTask *tp = new DbUpdTask(udi, doc.ipath.empty() ?
cstr_null : parent_udi, doc);
if (!m_dwqueue.put(tp)) {
LOGERR(("processonefile: wqueue.put failed\n"));
LOGERR("processonefile: wqueue.put failed\n" );
return FsTreeWalker::FtwError;
}
} else {
@ -839,8 +822,7 @@ FsIndexer::processonefile(RclConfig *config,
// If this doc existed and it's a container, recording for
// possible subdoc purge (this will be used only if we don't do a
// db-wide purge, e.g. if we're called from indexfiles()).
LOGDEB2(("processOnefile: existingDoc %d hadNonNullIpath %d\n",
existingDoc, hadNonNullIpath));
LOGDEB2("processOnefile: existingDoc " << (existingDoc) << " hadNonNullIpath " << (hadNonNullIpath) << "\n" );
if (existingDoc && hadNonNullIpath) {
m_purgeCandidates.record(parent_udi);
}
@ -853,7 +835,7 @@ FsIndexer::processonefile(RclConfig *config,
// If xattronly is set, ONLY the extattr metadata is valid and will be used
// by the following step.
if (xattronly || hadNullIpath == false) {
LOGDEB(("Creating empty doc for file or pure xattr update\n"));
LOGDEB("Creating empty doc for file or pure xattr update\n" );
Rcl::Doc fileDoc;
if (xattronly) {
map<string, string> xfields;
@ -889,3 +871,4 @@ FsIndexer::processonefile(RclConfig *config,
return FsTreeWalker::FtwOk;
}

View file

@ -142,7 +142,6 @@ class FsIndexer : public FsTreeWalkerCB {
#ifdef IDX_THREADS
friend void *FsIndexerDbUpdWorker(void*);
friend void *FsIndexerInternfileWorker(void*);
int m_loglevel;
WorkQueue<InternfileTask*> m_iwqueue;
WorkQueue<DbUpdTask*> m_dwqueue;
bool m_haveInternQ;

View file

@ -22,7 +22,7 @@
#include <algorithm>
#include "cstr.h"
#include "debuglog.h"
#include "log.h"
#include "indexer.h"
#include "fsindexer.h"
#ifndef DISABLE_WEB_INDEXER
@ -60,13 +60,13 @@ bool ConfIndexer::runFirstIndexing()
{
// Indexing status file existing and not empty ?
if (path_filesize(m_config->getIdxStatusFile()) > 0) {
LOGDEB0(("ConfIndexer::runFirstIndexing: no: status file not empty\n"));
LOGDEB0("ConfIndexer::runFirstIndexing: no: status file not empty\n" );
return false;
}
// And only do this if the user has kept the default topdirs (~).
vector<string> tdl = m_config->getTopdirs();
if (tdl.size() != 1 || tdl[0].compare(path_canon(path_tildexpand("~")))) {
LOGDEB0(("ConfIndexer::runFirstIndexing: no: not home only\n"));
LOGDEB0("ConfIndexer::runFirstIndexing: no: not home only\n" );
return false;
}
return true;
@ -74,7 +74,7 @@ bool ConfIndexer::runFirstIndexing()
bool ConfIndexer::firstFsIndexingSequence()
{
LOGDEB(("ConfIndexer::firstFsIndexingSequence\n"));
LOGDEB("ConfIndexer::firstFsIndexingSequence\n" );
deleteZ(m_fsindexer);
m_fsindexer = new FsIndexer(m_config, &m_db, m_updater);
if (!m_fsindexer) {
@ -92,8 +92,7 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun, int flags)
{
Rcl::Db::OpenMode mode = resetbefore ? Rcl::Db::DbTrunc : Rcl::Db::DbUpd;
if (!m_db.open(mode)) {
LOGERR(("ConfIndexer: error opening database %s : %s\n",
m_config->getDbDir().c_str(), m_db.getReason().c_str()));
LOGERR("ConfIndexer: error opening database " << (m_config->getDbDir()) << " : " << (m_db.getReason()) << "\n" );
return false;
}
@ -135,8 +134,7 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun, int flags)
if (m_updater)
m_updater->update(DbIxStatus::DBIXS_CLOSING, string());
if (!m_db.close()) {
LOGERR(("ConfIndexer::index: error closing database in %s\n",
m_config->getDbDir().c_str()));
LOGERR("ConfIndexer::index: error closing database in " << (m_config->getDbDir()) << "\n" );
return false;
}
@ -163,8 +161,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
myfiles.sort();
if (!m_db.open(Rcl::Db::DbUpd)) {
LOGERR(("ConfIndexer: indexFiles error opening database %s\n",
m_config->getDbDir().c_str()));
LOGERR("ConfIndexer: indexFiles error opening database " << (m_config->getDbDir()) << "\n" );
return false;
}
m_config->setKeyDir(cstr_null);
@ -173,8 +170,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
m_fsindexer = new FsIndexer(m_config, &m_db, m_updater);
if (m_fsindexer)
ret = m_fsindexer->indexFiles(myfiles, flag);
LOGDEB2(("ConfIndexer::indexFiles: fsindexer returned %d, "
"%d files remainining\n", ret, myfiles.size()));
LOGDEB2("ConfIndexer::indexFiles: fsindexer returned " << (ret) << ", " << (myfiles.size()) << " files remainining\n" );
#ifndef DISABLE_WEB_INDEXER
if (m_dobeagle && !myfiles.empty() && !(flag & IxFNoWeb)) {
@ -189,8 +185,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
#endif
// The close would be done in our destructor, but we want status here
if (!m_db.close()) {
LOGERR(("ConfIndexer::index: error closing database in %s\n",
m_config->getDbDir().c_str()));
LOGERR("ConfIndexer::index: error closing database in " << (m_config->getDbDir()) << "\n" );
return false;
}
ifiles = myfiles;
@ -214,8 +209,7 @@ bool ConfIndexer::docsToPaths(vector<Rcl::Doc> &docs, vector<string> &paths)
// Filesystem document. The url has to be like file://
if (idoc.url.find(cstr_fileu) != 0) {
LOGERR(("idx::docsToPaths: FS backend and non fs url: [%s]\n",
idoc.url.c_str()));
LOGERR("idx::docsToPaths: FS backend and non fs url: [" << (idoc.url) << "]\n" );
continue;
}
paths.push_back(idoc.url.substr(7, string::npos));
@ -247,8 +241,7 @@ bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
myfiles.sort();
if (!m_db.open(Rcl::Db::DbUpd)) {
LOGERR(("ConfIndexer: purgeFiles error opening database %s\n",
m_config->getDbDir().c_str()));
LOGERR("ConfIndexer: purgeFiles error opening database " << (m_config->getDbDir()) << "\n" );
return false;
}
bool ret = false;
@ -272,8 +265,7 @@ bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
// The close would be done in our destructor, but we want status here
if (!m_db.close()) {
LOGERR(("ConfIndexer::purgefiles: error closing database in %s\n",
m_config->getDbDir().c_str()));
LOGERR("ConfIndexer::purgefiles: error closing database in " << (m_config->getDbDir()) << "\n" );
return false;
}
return ret;
@ -286,7 +278,7 @@ bool ConfIndexer::createStemmingDatabases()
string slangs;
if (m_config->getConfParam("indexstemminglanguages", slangs)) {
if (!m_db.open(Rcl::Db::DbUpd)) {
LOGERR(("ConfIndexer::createStemmingDb: could not open db\n"))
LOGERR("ConfIndexer::createStemmingDb: could not open db\n" );
return false;
}
vector<string> langs;
@ -319,7 +311,7 @@ bool ConfIndexer::createStemDb(const string &lang)
// module, either from a configuration variable or the NLS environment.
bool ConfIndexer::createAspellDict()
{
LOGDEB2(("ConfIndexer::createAspellDict()\n"));
LOGDEB2("ConfIndexer::createAspellDict()\n" );
#ifdef RCL_USE_ASPELL
// For the benefit of the real-time indexer, we only initialize
// noaspell from the configuration once. It can then be set to
@ -334,22 +326,20 @@ bool ConfIndexer::createAspellDict()
return true;
if (!m_db.open(Rcl::Db::DbRO)) {
LOGERR(("ConfIndexer::createAspellDict: could not open db\n"));
LOGERR("ConfIndexer::createAspellDict: could not open db\n" );
return false;
}
Aspell aspell(m_config);
string reason;
if (!aspell.init(reason)) {
LOGERR(("ConfIndexer::createAspellDict: aspell init failed: %s\n",
reason.c_str()));
LOGERR("ConfIndexer::createAspellDict: aspell init failed: " << (reason) << "\n" );
noaspell = true;
return false;
}
LOGDEB(("ConfIndexer::createAspellDict: creating dictionary\n"));
LOGDEB("ConfIndexer::createAspellDict: creating dictionary\n" );
if (!aspell.buildDict(m_db, reason)) {
LOGERR(("ConfIndexer::createAspellDict: aspell buildDict failed: %s\n",
reason.c_str()));
LOGERR("ConfIndexer::createAspellDict: aspell buildDict failed: " << (reason) << "\n" );
noaspell = true;
return false;
}
@ -361,3 +351,4 @@ vector<string> ConfIndexer::getStemmerNames()
{
return Rcl::Db::getStemmerNames();
}

View file

@ -26,7 +26,7 @@
using namespace std;
#include "mimetype.h"
#include "debuglog.h"
#include "log.h"
#include "execmd.h"
#include "rclconfig.h"
#include "smallut.h"
@ -64,7 +64,7 @@ static string mimetypefromdata(RclConfig *cfg, const string &fn, bool usfc)
vector<string> cmd;
string scommand;
if (cfg->getConfParam("systemfilecommand", scommand)) {
LOGDEB2(("mimetype: syscmd from config: %s\n", scommand.c_str()));
LOGDEB2("mimetype: syscmd from config: " << (scommand) << "\n" );
stringToStrings(scommand, cmd);
string exe;
if (cmd.empty()) {
@ -76,19 +76,17 @@ static string mimetypefromdata(RclConfig *cfg, const string &fn, bool usfc)
}
cmd.push_back(fn);
} else {
LOGDEB(("mimetype:systemfilecommand not found, using %s\n",
stringsToString(tradfilecmd).c_str()));
LOGDEB("mimetype:systemfilecommand not found, using " << (stringsToString(tradfilecmd)) << "\n" );
cmd = tradfilecmd;
}
string result;
if (!ExecCmd::backtick(cmd, result)) {
LOGERR(("mimetypefromdata: exec %s failed\n",
stringsToString(cmd).c_str()));
LOGERR("mimetypefromdata: exec " << (stringsToString(cmd)) << " failed\n" );
return string();
}
trimstring(result, " \t\n\r");
LOGDEB2(("mimetype: systemfilecommand output [%s]\n", result.c_str()));
LOGDEB2("mimetype: systemfilecommand output [" << (result) << "]\n" );
// The normal output from "file -i" looks like the following:
// thefilename.xxx: text/plain; charset=us-ascii
@ -109,8 +107,7 @@ static string mimetypefromdata(RclConfig *cfg, const string &fn, bool usfc)
if (result.find(fn) != 0) {
// Garbage "file" output. Maybe the result of a charset
// conversion attempt?
LOGERR(("mimetype: can't interpret 'file' output: [%s]\n",
result.c_str()));
LOGERR("mimetype: can't interpret 'file' output: [" << (result) << "]\n" );
return string();
}
result = result.substr(fn.size());
@ -164,9 +161,9 @@ string mimetype(const string &fn, const struct stat *stp,
// Extended attribute has priority on everything, as per:
// http://freedesktop.org/wiki/CommonExtendedAttributes
if (pxattr::get(fn, "mime_type", &mtype)) {
LOGDEB0(("Mimetype: 'mime_type' xattr : [%s]\n", mtype.c_str()));
LOGDEB0("Mimetype: 'mime_type' xattr : [" << (mtype) << "]\n" );
if (mtype.empty()) {
LOGDEB0(("Mimetype: getxattr() returned empty mime type !\n"));
LOGDEB0("Mimetype: getxattr() returned empty mime type !\n" );
} else {
return mtype;
}
@ -174,12 +171,12 @@ string mimetype(const string &fn, const struct stat *stp,
#endif
if (cfg == 0) {
LOGERR(("Mimetype: null config ??\n"));
LOGERR("Mimetype: null config ??\n" );
return mtype;
}
if (cfg->inStopSuffixes(fn)) {
LOGDEB(("mimetype: fn [%s] in stopsuffixes\n", fn.c_str()));
LOGDEB("mimetype: fn [" << (fn) << "] in stopsuffixes\n" );
return mtype;
}
@ -211,7 +208,8 @@ string mimetype(const string &fn, const struct stat *stp,
#include <cstdlib>
#include <iostream>
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "rclinit.h"
#include "mimetype.h"
@ -245,3 +243,4 @@ int main(int argc, const char **argv)
#endif // TEST

View file

@ -37,9 +37,10 @@
using std::list;
using std::vector;
#include "debuglog.h"
#include "log.h"
#include "rclmon.h"
#include "debuglog.h"
#include "log.h"
#include "execmd.h"
#include "recollindex.h"
#include "pathut.h"
@ -167,7 +168,7 @@ void RclEQData::readDelayPats(int dfltsecs)
vector<string> dplist;
if (!stringToStrings(patstring, dplist)) {
LOGERR(("rclEQData: bad pattern list: [%s]\n", patstring.c_str()));
LOGERR("rclEQData: bad pattern list: [" << (patstring) << "]\n" );
return;
}
@ -182,8 +183,7 @@ void RclEQData::readDelayPats(int dfltsecs)
dp.seconds = dfltsecs;
}
m_delaypats.push_back(dp);
LOGDEB2(("rclmon::readDelayPats: add [%s] %d\n",
dp.pattern.c_str(), dp.seconds));
LOGDEB2("rclmon::readDelayPats: add [" << (dp.pattern) << "] " << (dp.seconds) << "\n" );
}
}
@ -246,14 +246,12 @@ bool RclMonEventQueue::wait(int seconds, bool *top)
MONDEB(("RclMonEventQueue:: timeout\n"));
return true;
}
LOGERR(("RclMonEventQueue::wait:pthread_cond_timedwait failed"
"with err %d\n", err));
LOGERR("RclMonEventQueue::wait:pthread_cond_timedwait failedwith err " << (err) << "\n" );
return false;
}
} else {
if ((err = pthread_cond_wait(&m_data->m_cond, &m_data->m_mutex))) {
LOGERR(("RclMonEventQueue::wait: pthread_cond_wait failed"
"with err %d\n", err));
LOGERR("RclMonEventQueue::wait: pthread_cond_wait failedwith err " << (err) << "\n" );
return false;
}
}
@ -265,7 +263,7 @@ bool RclMonEventQueue::lock()
{
MONDEB(("RclMonEventQueue:: lock\n"));
if (pthread_mutex_lock(&m_data->m_mutex)) {
LOGERR(("RclMonEventQueue::lock: pthread_mutex_lock failed\n"));
LOGERR("RclMonEventQueue::lock: pthread_mutex_lock failed\n" );
return false;
}
MONDEB(("RclMonEventQueue:: lock return\n"));
@ -276,7 +274,7 @@ bool RclMonEventQueue::unlock()
{
MONDEB(("RclMonEventQueue:: unlock\n"));
if (pthread_mutex_unlock(&m_data->m_mutex)) {
LOGERR(("RclMonEventQueue::lock: pthread_mutex_unlock failed\n"));
LOGERR("RclMonEventQueue::lock: pthread_mutex_unlock failed\n" );
return false;
}
return true;
@ -298,15 +296,15 @@ RclConfig *RclMonEventQueue::getConfig()
bool RclMonEventQueue::ok()
{
if (m_data == 0) {
LOGINFO(("RclMonEventQueue: not ok: bad state\n"));
LOGINFO("RclMonEventQueue: not ok: bad state\n" );
return false;
}
if (stopindexing) {
LOGINFO(("RclMonEventQueue: not ok: stop request\n"));
LOGINFO("RclMonEventQueue: not ok: stop request\n" );
return false;
}
if (!m_data->m_ok) {
LOGINFO(("RclMonEventQueue: not ok: queue terminated\n"));
LOGINFO("RclMonEventQueue: not ok: queue terminated\n" );
return false;
}
return true;
@ -489,15 +487,15 @@ bool startMonitor(RclConfig *conf, int opts)
rclEQ.setopts(opts);
if (pthread_create(&rcv_thrid, 0, &rclMonRcvRun, &rclEQ) != 0) {
LOGERR(("startMonitor: cant create event-receiving thread\n"));
LOGERR("startMonitor: cant create event-receiving thread\n" );
return false;
}
if (!rclEQ.lock()) {
LOGERR(("startMonitor: cant lock queue ???\n"));
LOGERR("startMonitor: cant lock queue ???\n" );
return false;
}
LOGDEB(("start_monitoring: entering main loop\n"));
LOGDEB("start_monitoring: entering main loop\n" );
bool timedout;
time_t lastauxtime = time(0);
@ -515,7 +513,7 @@ bool startMonitor(RclConfig *conf, int opts)
#ifndef _WIN32
bool x11dead = !(opts & RCLMON_NOX11) && !x11IsAlive();
if (x11dead)
LOGDEB(("RclMonprc: x11 is dead\n"));
LOGDEB("RclMonprc: x11 is dead\n" );
#else
bool x11dead = false;
#endif
@ -533,11 +531,11 @@ bool startMonitor(RclConfig *conf, int opts)
switch (ev.evtype()) {
case RclMonEvent::RCLEVT_MODIFY:
case RclMonEvent::RCLEVT_DIRCREATE:
LOGDEB0(("Monitor: Modify/Check on %s\n", ev.m_path.c_str()));
LOGDEB0("Monitor: Modify/Check on " << (ev.m_path) << "\n" );
modified.push_back(ev.m_path);
break;
case RclMonEvent::RCLEVT_DELETE:
LOGDEB0(("Monitor: Delete on %s\n", ev.m_path.c_str()));
LOGDEB0("Monitor: Delete on " << (ev.m_path) << "\n" );
// If this is for a directory (which the caller should
// tell us because he knows), we should purge the db
// of all the subtree, because on a directory rename,
@ -556,7 +554,7 @@ bool startMonitor(RclConfig *conf, int opts)
}
break;
default:
LOGDEB(("Monitor: got Other on [%s]\n", ev.m_path.c_str()));
LOGDEB("Monitor: got Other on [" << (ev.m_path) << "]\n" );
}
}
// Unlock queue before processing lists
@ -603,7 +601,7 @@ bool startMonitor(RclConfig *conf, int opts)
// Check for a config change
if (!(opts & RCLMON_NOCONFCHECK) && o_reexec && conf->sourceChanged()) {
LOGDEB(("Rclmonprc: config changed, reexecuting myself\n"));
LOGDEB("Rclmonprc: config changed, reexecuting myself\n" );
// We never want to have a -n option after a config
// change. -n was added by the reexec after the initial
// pass even if it was not given on the command line
@ -613,7 +611,7 @@ bool startMonitor(RclConfig *conf, int opts)
// Lock queue before waiting again
rclEQ.lock();
}
LOGDEB(("Rclmonprc: calling queue setTerminate\n"));
LOGDEB("Rclmonprc: calling queue setTerminate\n" );
rclEQ.setTerminate();
// We used to wait for the receiver thread here before returning,
@ -622,8 +620,9 @@ bool startMonitor(RclConfig *conf, int opts)
// we ever need several monitor invocations in the same process
// (can't foresee any reason why we'd want to do this).
// pthread_join(rcv_thrid, 0);
LOGDEB(("Monitor: returning\n"));
LOGDEB("Monitor: returning\n" );
return true;
}
#endif // RCL_MONITOR

View file

@ -24,7 +24,7 @@
#include "safesysstat.h"
#include "safeunistd.h"
#include "debuglog.h"
#include "log.h"
#include "rclmon.h"
#include "rclinit.h"
#include "fstreewalk.h"
@ -148,26 +148,17 @@ void *rclMonRcvRun(void *q)
{
RclMonEventQueue *queue = (RclMonEventQueue *)q;
LOGDEB(("rclMonRcvRun: running\n"));
LOGDEB("rclMonRcvRun: running\n" );
recoll_threadinit();
// Make a local copy of the configuration as it doesn't like
// concurrent accesses. It's ok to copy it here as the other
// thread will not work before we have sent events.
RclConfig lconfig(*queue->getConfig());
string loglevel;
lconfig.getConfParam(string("daemloglevel"), loglevel);
if (loglevel.empty())
lconfig.getConfParam(string("loglevel"), loglevel);
if (!loglevel.empty()) {
int lev = atoi(loglevel.c_str());
DebugLog::getdbl()->setloglevel(lev);
}
// Create the fam/whatever interface object
RclMonitor *mon;
if ((mon = makeMonitor()) == 0) {
LOGERR(("rclMonRcvRun: makeMonitor failed\n"));
LOGERR("rclMonRcvRun: makeMonitor failed\n" );
queue->setTerminate();
return 0;
}
@ -176,8 +167,7 @@ void *rclMonRcvRun(void *q)
// Get top directories from config
vector<string> tdl = lconfig.getTopdirs();
if (tdl.empty()) {
LOGERR(("rclMonRcvRun:: top directory list (topdirs param.) not"
"found in config or Directory list parse error"));
LOGERR("rclMonRcvRun:: top directory list (topdirs param.) notfound in config or Directory list parse error" );
queue->setTerminate();
return 0;
}
@ -196,14 +186,13 @@ void *rclMonRcvRun(void *q)
} else {
walker.setOpts(FsTreeWalker::FtwOptNone);
}
LOGDEB(("rclMonRcvRun: walking %s\n", it->c_str()));
LOGDEB("rclMonRcvRun: walking " << *it << "\n" );
if (walker.walk(*it, walkcb) != FsTreeWalker::FtwOk) {
LOGERR(("rclMonRcvRun: tree walk failed\n"));
LOGERR("rclMonRcvRun: tree walk failed\n" );
goto terminate;
}
if (walker.getErrCnt() > 0) {
LOGINFO(("rclMonRcvRun: fs walker errors: %s\n",
walker.getReason().c_str()));
LOGINFO("rclMonRcvRun: fs walker errors: " << (walker.getReason()) << "\n" );
}
}
@ -213,7 +202,7 @@ void *rclMonRcvRun(void *q)
if (doweb) {
string webqueuedir = lconfig.getWebQueueDir();
if (!mon->addWatch(webqueuedir, true)) {
LOGERR(("rclMonRcvRun: addwatch (webqueuedir) failed\n"));
LOGERR("rclMonRcvRun: addwatch (webqueuedir) failed\n" );
if (mon->saved_errno != EACCES && mon->saved_errno != ENOENT)
goto terminate;
}
@ -249,16 +238,13 @@ void *rclMonRcvRun(void *q)
// it seems that fam/gamin is doing the job for us so
// that we are generating double events here (no big
// deal as prc will sort/merge).
LOGDEB(("rclMonRcvRun: walking new dir %s\n",
ev.m_path.c_str()));
LOGDEB("rclMonRcvRun: walking new dir " << (ev.m_path) << "\n" );
if (walker.walk(ev.m_path, walkcb) != FsTreeWalker::FtwOk) {
LOGERR(("rclMonRcvRun: walking new dir %s: %s\n",
ev.m_path.c_str(), walker.getReason().c_str()));
LOGERR("rclMonRcvRun: walking new dir " << (ev.m_path) << ": " << (walker.getReason()) << "\n" );
goto terminate;
}
if (walker.getErrCnt() > 0) {
LOGINFO(("rclMonRcvRun: fs walker errors: %s\n",
walker.getReason().c_str()));
LOGINFO("rclMonRcvRun: fs walker errors: " << (walker.getReason()) << "\n" );
}
}
@ -269,7 +255,7 @@ void *rclMonRcvRun(void *q)
terminate:
queue->setTerminate();
LOGINFO(("rclMonRcvRun: monrcv thread routine returning\n"));
LOGINFO("rclMonRcvRun: monrcv thread routine returning\n" );
return 0;
}
@ -353,7 +339,7 @@ RclFAM::RclFAM()
: m_ok(false)
{
if (FAMOpen2(&m_conn, "Recoll")) {
LOGERR(("RclFAM::RclFAM: FAMOpen2 failed, errno %d\n", errno));
LOGERR("RclFAM::RclFAM: FAMOpen2 failed, errno " << (errno) << "\n" );
return;
}
m_ok = true;
@ -384,7 +370,7 @@ bool RclFAM::addWatch(const string& path, bool isdir)
// to unblock signals. SIGALRM is not used by the main thread, so at least
// ensure that we exit after gamin gets stuck.
if (setjmp(jbuf)) {
LOGERR(("RclFAM::addWatch: timeout talking to FAM\n"));
LOGERR("RclFAM::addWatch: timeout talking to FAM\n" );
return false;
}
signal(SIGALRM, onalrm);
@ -392,12 +378,12 @@ bool RclFAM::addWatch(const string& path, bool isdir)
FAMRequest req;
if (isdir) {
if (FAMMonitorDirectory(&m_conn, path.c_str(), &req, 0) != 0) {
LOGERR(("RclFAM::addWatch: FAMMonitorDirectory failed\n"));
LOGERR("RclFAM::addWatch: FAMMonitorDirectory failed\n" );
goto out;
}
} else {
if (FAMMonitorFile(&m_conn, path.c_str(), &req, 0) != 0) {
LOGERR(("RclFAM::addWatch: FAMMonitorFile failed\n"));
LOGERR("RclFAM::addWatch: FAMMonitorFile failed\n" );
goto out;
}
}
@ -435,7 +421,7 @@ bool RclFAM::getEvent(RclMonEvent& ev, int msecs)
}
int ret;
if ((ret=select(fam_fd+1, &readfds, 0, 0, msecs >= 0 ? &timeout : 0)) < 0) {
LOGERR(("RclFAM::getEvent: select failed, errno %d\n", errno));
LOGERR("RclFAM::getEvent: select failed, errno " << (errno) << "\n" );
close();
return false;
} else if (ret == 0) {
@ -462,7 +448,7 @@ bool RclFAM::getEvent(RclMonEvent& ev, int msecs)
MONDEB(("RclFAM::getEvent: call FAMNextEvent\n"));
FAMEvent fe;
if (FAMNextEvent(&m_conn, &fe) < 0) {
LOGERR(("RclFAM::getEvent: FAMNextEvent failed, errno %d\n", errno));
LOGERR("RclFAM::getEvent: FAMNextEvent failed, errno " << (errno) << "\n" );
close();
return false;
}
@ -511,7 +497,7 @@ bool RclFAM::getEvent(RclMonEvent& ev, int msecs)
// Have to return something, this is different from an empty queue,
// esp if we are trying to empty it...
if (fe.code != FAMEndExist)
LOGDEB(("RclFAM::getEvent: got other event %d!\n", fe.code));
LOGDEB("RclFAM::getEvent: got other event " << (fe.code) << "!\n" );
ev.m_etyp = RclMonEvent::RCLEVT_NONE;
break;
}
@ -532,7 +518,7 @@ public:
: m_ok(false), m_fd(-1), m_evp(0), m_ep(0)
{
if ((m_fd = inotify_init()) < 0) {
LOGERR(("RclIntf:: inotify_init failed, errno %d\n", errno));
LOGERR("RclIntf:: inotify_init failed, errno " << (errno) << "\n" );
return;
}
m_ok = true;
@ -616,11 +602,9 @@ bool RclIntf::addWatch(const string& path, bool)
int wd;
if ((wd = inotify_add_watch(m_fd, path.c_str(), mask)) < 0) {
saved_errno = errno;
LOGERR(("RclIntf::addWatch: inotify_add_watch failed. errno %d\n",
saved_errno));
LOGERR("RclIntf::addWatch: inotify_add_watch failed. errno " << (saved_errno) << "\n" );
if (errno == ENOSPC) {
LOGERR(("RclIntf::addWatch: ENOSPC error may mean that you need"
"increase the inotify kernel constants. See inotify(7)\n"));
LOGERR("RclIntf::addWatch: ENOSPC error may mean that you needincrease the inotify kernel constants. See inotify(7)\n" );
}
return false;
}
@ -649,7 +633,7 @@ bool RclIntf::getEvent(RclMonEvent& ev, int msecs)
int ret;
MONDEB(("RclIntf::getEvent: select\n"));
if ((ret=select(m_fd + 1, &readfds, 0, 0, msecs >= 0 ? &timeout : 0)) < 0) {
LOGERR(("RclIntf::getEvent: select failed, errno %d\n", errno));
LOGERR("RclIntf::getEvent: select failed, errno " << (errno) << "\n" );
close();
return false;
} else if (ret == 0) {
@ -663,8 +647,7 @@ bool RclIntf::getEvent(RclMonEvent& ev, int msecs)
return false;
int rret;
if ((rret=read(m_fd, m_evbuf, sizeof(m_evbuf))) <= 0) {
LOGERR(("RclIntf::getEvent: read failed, %d->%d errno %d\n",
sizeof(m_evbuf), rret, errno));
LOGERR("RclIntf::getEvent: read failed, " << (sizeof(m_evbuf)) << "->" << (rret) << " errno " << (errno) << "\n" );
close();
return false;
}
@ -681,7 +664,7 @@ bool RclIntf::getEvent(RclMonEvent& ev, int msecs)
map<int,string>::const_iterator it;
if ((it = m_idtopath.find(evp->wd)) == m_idtopath.end()) {
LOGERR(("RclIntf::getEvent: unknown wd %d\n", evp->wd));
LOGERR("RclIntf::getEvent: unknown wd " << (evp->wd) << "\n" );
return true;
}
ev.m_path = it->second;
@ -721,13 +704,12 @@ bool RclIntf::getEvent(RclMonEvent& ev, int msecs)
}
} else if (evp->mask & (IN_IGNORED)) {
if (!m_idtopath.erase(evp->wd)) {
LOGDEB0(("Got IGNORE event for unknown watch\n"));
LOGDEB0("Got IGNORE event for unknown watch\n" );
} else {
eraseWatchSubTree(m_idtopath, ev.m_path);
}
} else {
LOGDEB(("RclIntf::getEvent: unhandled event %s 0x%x %s\n",
event_name(evp->mask), evp->mask, ev.m_path.c_str()));
LOGDEB("RclIntf::getEvent: unhandled event " << (event_name(evp->mask)) << " 0x" << (evp->mask) << " " << (ev.m_path) << "\n" );
return true;
}
return true;
@ -748,8 +730,8 @@ static RclMonitor *makeMonitor()
return new RclFAM;
#endif
#endif
LOGINFO(("RclMonitor: neither Inotify nor Fam was compiled as "
"file system change notification interface\n"));
LOGINFO("RclMonitor: neither Inotify nor Fam was compiled as file system change notification interface\n" );
return 0;
}
#endif // RCL_MONITOR

View file

@ -36,7 +36,7 @@
using namespace std;
#include "debuglog.h"
#include "log.h"
#include "rclinit.h"
#include "indexer.h"
#include "smallut.h"
@ -148,7 +148,7 @@ class MyUpdater : public DbIxStatusUpdater {
// out and the indexing would go on, not good (ie: if the user
// logs in again, the new recollindex will fail).
if ((op_flags & OPT_m) && !(op_flags & OPT_x) && !x11IsAlive()) {
LOGDEB(("X11 session went away during initial indexing pass\n"));
LOGDEB("X11 session went away during initial indexing pass\n" );
stopindexing = true;
return false;
}
@ -166,7 +166,7 @@ static MyUpdater *updater;
static void sigcleanup(int sig)
{
fprintf(stderr, "Got signal, registering stop request\n");
LOGDEB(("Got signal, registering stop request\n"));
LOGDEB("Got signal, registering stop request\n" );
CancelCheck::instance().setCancel();
stopindexing = 1;
}
@ -301,7 +301,7 @@ static bool checktopdirs(RclConfig *config, vector<string>& nonexist)
vector<string> tdl;
if (!config->getConfParam("topdirs", &tdl)) {
cerr << "No 'topdirs' parameter in configuration\n";
LOGERR(("recollindex:No 'topdirs' parameter in configuration\n"));;
LOGERR("recollindex:No 'topdirs' parameter in configuration\n" );;
return false;
}
@ -310,12 +310,10 @@ static bool checktopdirs(RclConfig *config, vector<string>& nonexist)
if (!it->size() || !path_isabsolute(*it)) {
if ((*it)[0] == '~') {
cerr << "Tilde expansion failed: " << *it << endl;
LOGERR(("recollindex: tilde expansion failed: %s\n",
it->c_str()));
LOGERR("recollindex: tilde expansion failed: " << *it << "\n" );
} else {
cerr << "Not an absolute path: " << *it << endl;
LOGERR(("recollindex: not an absolute path: %s\n",
it->c_str()));
LOGERR("recollindex: not an absolute path: " << *it << "\n" );
}
return false;
}
@ -516,18 +514,14 @@ int main(int argc, char **argv)
string rundir;
config->getConfParam("idxrundir", rundir);
if (!rundir.compare("tmp")) {
LOGINFO(("recollindex: changing current directory to [%s]\n",
tmplocation().c_str()));
LOGINFO("recollindex: changing current directory to [" << (tmplocation()) << "]\n" );
if (chdir(tmplocation().c_str()) < 0) {
LOGERR(("chdir(%s) failed, errno %d\n",
tmplocation().c_str(), errno));
LOGERR("chdir(" << (tmplocation()) << ") failed, errno " << (errno) << "\n" );
}
} else if (!rundir.empty()) {
LOGINFO(("recollindex: changing current directory to [%s]\n",
rundir.c_str()));
LOGINFO("recollindex: changing current directory to [" << (rundir) << "]\n" );
if (chdir(rundir.c_str()) < 0) {
LOGERR(("chdir(%s) failed, errno %d\n",
rundir.c_str(), errno));
LOGERR("chdir(" << (rundir) << ") failed, errno " << (errno) << "\n" );
}
}
@ -550,10 +544,10 @@ int main(int argc, char **argv)
// Log something at LOGINFO to reset the trace file. Else at level
// 3 it's not even truncated if all docs are up to date.
LOGINFO(("recollindex: starting up\n"));
LOGINFO("recollindex: starting up\n" );
#ifndef _WIN32
if (setpriority(PRIO_PROCESS, 0, 20) != 0) {
LOGINFO(("recollindex: can't setpriority(), errno %d\n", errno));
LOGINFO("recollindex: can't setpriority(), errno " << (errno) << "\n" );
}
// Try to ionice. This does not work on all platforms
rclIxIonice(config);
@ -625,11 +619,11 @@ int main(int argc, char **argv)
Usage();
lockorexit(&pidfile);
if (!(op_flags&OPT_D)) {
LOGDEB(("recollindex: daemonizing\n"));
LOGDEB("recollindex: daemonizing\n" );
#ifndef _WIN32
if (daemon(0,0) != 0) {
fprintf(stderr, "daemon() failed, errno %d\n", errno);
LOGERR(("daemon() failed, errno %d\n", errno));
LOGERR("daemon() failed, errno " << (errno) << "\n" );
exit(1);
}
#endif
@ -640,30 +634,29 @@ int main(int argc, char **argv)
// Not too sure if I have to redo the nice thing after daemon(),
// can't hurt anyway (easier than testing on all platforms...)
if (setpriority(PRIO_PROCESS, 0, 20) != 0) {
LOGINFO(("recollindex: can't setpriority(), errno %d\n", errno));
LOGINFO("recollindex: can't setpriority(), errno " << (errno) << "\n" );
}
// Try to ionice. This does not work on all platforms
rclIxIonice(config);
#endif
if (sleepsecs > 0) {
LOGDEB(("recollindex: sleeping %d\n", sleepsecs));
LOGDEB("recollindex: sleeping " << (sleepsecs) << "\n" );
for (int i = 0; i < sleepsecs; i++) {
sleep(1);
// Check that x11 did not go away while we were sleeping.
if (!(op_flags & OPT_x) && !x11IsAlive()) {
LOGDEB(("X11 session went away during initial sleep period\n"));
LOGDEB("X11 session went away during initial sleep period\n" );
exit(0);
}
}
}
if (!(op_flags & OPT_n)) {
makeIndexerOrExit(config, inPlaceReset);
LOGDEB(("Recollindex: initial indexing pass before monitoring\n"));
LOGDEB("Recollindex: initial indexing pass before monitoring\n" );
if (!confindexer->index(rezero, ConfIndexer::IxTAll, indexerFlags)
|| stopindexing) {
LOGERR(("recollindex, initial indexing pass failed, "
"not going into monitor mode\n"));
LOGERR("recollindex, initial indexing pass failed, not going into monitor mode\n" );
exit(1);
} else {
// Record success of indexing pass with failed files retries.
@ -674,7 +667,7 @@ int main(int argc, char **argv)
deleteZ(confindexer);
#ifndef _WIN32
o_reexec->insertArgs(vector<string>(1, "-n"));
LOGINFO(("recollindex: reexecuting with -n after initial full pass\n"));
LOGINFO("recollindex: reexecuting with -n after initial full pass\n" );
// Note that -n will be inside the reexec when we come
// back, but the monitor will explicitely strip it before
// starting a config change exec to ensure that we do a
@ -724,3 +717,4 @@ int main(int argc, char **argv)
return !status;
}
}

View file

@ -25,16 +25,15 @@
#include "searchdata.h"
#include "rclquery.h"
#include "subtreelist.h"
#include "debuglog.h"
#include "log.h"
bool subtreelist(RclConfig *config, const string& top,
vector<string>& paths)
{
LOGDEB(("subtreelist: top: [%s]\n", top.c_str()));
LOGDEB("subtreelist: top: [" << (top) << "]\n" );
Rcl::Db rcldb(config);
if (!rcldb.open(Rcl::Db::DbRO)) {
LOGERR(("subtreelist: can't open database in [%s]: %s\n",
config->getDbDir().c_str(), rcldb.getReason().c_str()));
LOGERR("subtreelist: can't open database in [" << (config->getDbDir()) << "]: " << (rcldb.getReason()) << "\n" );
return false;
}
@ -129,3 +128,4 @@ int main(int argc, char **argv)
exit(0);
}
#endif

View file

@ -21,7 +21,7 @@
#include "rclconfig.h"
#include "pxattr.h"
#include "debuglog.h"
#include "log.h"
#include "cstr.h"
#include "rcldoc.h"
#include "execmd.h"
@ -33,8 +33,7 @@ static void docfieldfrommeta(RclConfig* cfg, const string& name,
const string &value, Rcl::Doc& doc)
{
string fieldname = cfg->fieldCanon(name);
LOGDEB0(("Internfile:: setting [%s] from cmd/xattr value [%s]\n",
fieldname.c_str(), value.c_str()));
LOGDEB0("Internfile:: setting [" << (fieldname) << "] from cmd/xattr value [" << (value) << "]\n" );
if (fieldname == cstr_dj_keymd) {
doc.dmtime = value;
} else {
@ -45,17 +44,15 @@ static void docfieldfrommeta(RclConfig* cfg, const string& name,
void reapXAttrs(const RclConfig* cfg, const string& path,
map<string, string>& xfields)
{
LOGDEB2(("reapXAttrs: [%s]\n", path.c_str()));
LOGDEB2("reapXAttrs: [" << (path) << "]\n" );
#ifndef _WIN32
// Retrieve xattrs names from files and mapping table from config
vector<string> xnames;
if (!pxattr::list(path, &xnames)) {
if (errno == ENOTSUP) {
LOGDEB(("FileInterner::reapXattrs: pxattr::list: errno %d\n",
errno));
LOGDEB("FileInterner::reapXattrs: pxattr::list: errno " << (errno) << "\n" );
} else {
LOGERR(("FileInterner::reapXattrs: pxattr::list: errno %d\n",
errno));
LOGERR("FileInterner::reapXattrs: pxattr::list: errno " << (errno) << "\n" );
}
return;
}
@ -77,13 +74,12 @@ void reapXAttrs(const RclConfig* cfg, const string& path,
}
string value;
if (!pxattr::get(path, *it, &value, pxattr::PXATTR_NOFOLLOW)) {
LOGERR(("FileInterner::reapXattrs: pxattr::get failed"
"for %s, errno %d\n", (*it).c_str(), errno));
LOGERR("FileInterner::reapXattrs: pxattr::get failedfor " << ((*it)) << ", errno " << (errno) << "\n" );
continue;
}
// Encode should we ?
xfields[key] = value;
LOGDEB2(("reapXAttrs: [%s] -> [%s]\n", key.c_str(), value.c_str()));
LOGDEB2("reapXAttrs: [" << (key) << "] -> [" << (value) << "]\n" );
}
#endif
}
@ -150,3 +146,4 @@ void docFieldsFromMetaCmds(RclConfig *cfg, const map<string, string>& cfields,
}
}
}

View file

@ -18,9 +18,6 @@
#define _INDEXTEXT_H_INCLUDED_
/* Note: this only exists to help with using myhtmlparse.cc */
// Minimize changes to myhtmlparse.cpp
#include "debuglog.h"
#include <string>
// lets hope that the charset includes ascii values...

View file

@ -35,7 +35,7 @@ using namespace std;
#include "internfile.h"
#include "rcldoc.h"
#include "mimetype.h"
#include "debuglog.h"
#include "log.h"
#include "mimehandler.h"
#include "execmd.h"
#include "pathut.h"
@ -76,8 +76,7 @@ static string colon_restore(const string& in)
// (ie message having a given attachment)
bool FileInterner::getEnclosingUDI(const Rcl::Doc &doc, string& udi)
{
LOGDEB(("FileInterner::getEnclosingUDI(): url [%s] ipath [%s]\n",
doc.url.c_str(), doc.ipath.c_str()));
LOGDEB("FileInterner::getEnclosingUDI(): url [" << (doc.url) << "] ipath [" << (doc.ipath) << "]\n" );
string eipath = doc.ipath;
string::size_type colon;
if (eipath.empty())
@ -119,9 +118,9 @@ FileInterner::FileInterner(const string &fn, const struct stat *stp,
RclConfig *cnf, int flags, const string *imime)
: m_ok(false), m_missingdatap(0), m_uncomp((flags & FIF_forPreview) != 0)
{
LOGDEB0(("FileInterner::FileInterner(fn=%s)\n", fn.c_str()));
LOGDEB0("FileInterner::FileInterner(fn=" << (fn) << ")\n" );
if (fn.empty()) {
LOGERR(("FileInterner::FileInterner: empty file name!\n"));
LOGERR("FileInterner::FileInterner: empty file name!\n" );
return;
}
initcommon(cnf, flags);
@ -132,7 +131,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
int flags, const string *imime)
{
if (f.empty()) {
LOGERR(("FileInterner::init: empty file name!\n"));
LOGERR("FileInterner::init: empty file name!\n" );
return;
}
m_fn = f;
@ -157,13 +156,14 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
// (e.g. the beagle indexer sets it).
if (flags & FIF_doUseInputMimetype) {
if (!imime) {
LOGERR(("FileInterner:: told to use null imime\n"));
LOGERR("FileInterner:: told to use null imime\n" );
return;
}
l_mime = *imime;
} else {
LOGDEB(("FileInterner::init fn [%s] mime [%s] preview %d\n",
f.c_str(), imime?imime->c_str() : "(null)", m_forPreview));
LOGDEB("FileInterner::init fn [" << f << "] mime [" <<
(imime?imime->c_str() : "(null)") << "] preview " << m_forPreview
<< "\n" );
// Run mime type identification in any case (see comment above).
l_mime = mimetype(m_fn, stp, m_cfg, usfci);
@ -190,14 +190,12 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
if (!m_uncomp.uncompressfile(m_fn, ucmd, m_tfile)) {
return;
}
LOGDEB1(("FileInterner:: after ucomp: tfile %s\n",
m_tfile.c_str()));
LOGDEB1("FileInterner:: after ucomp: tfile " << (m_tfile) << "\n" );
m_fn = m_tfile;
// Stat the uncompressed file, mainly to get the size
struct stat ucstat;
if (path_fileprops(m_fn, &ucstat) != 0) {
LOGERR(("FileInterner: can't stat the uncompressed file"
"[%s] errno %d\n", m_fn.c_str(), errno));
LOGERR("FileInterner: can't stat the uncompressed file[" << (m_fn) << "] errno " << (errno) << "\n" );
return;
} else {
docsize = ucstat.st_size;
@ -206,8 +204,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
if (l_mime.empty() && imime)
l_mime = *imime;
} else {
LOGINFO(("FileInterner:: %s over size limit %d kbs\n",
m_fn.c_str(), maxkbs));
LOGINFO("FileInterner:: " << (m_fn) << " over size limit " << (maxkbs) << " kbs\n" );
}
}
}
@ -215,7 +212,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
if (l_mime.empty()) {
// No mime type. We let it through as config may warrant that
// we index all file names
LOGDEB0(("FileInterner:: no mime: [%s]\n", m_fn.c_str()));
LOGDEB0("FileInterner:: no mime: [" << (m_fn) << "]\n" );
}
// Look for appropriate handler (might still return empty)
@ -224,8 +221,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
if (!df || df->is_unknown()) {
// No real handler for this type, for now :(
LOGDEB(("FileInterner:: unprocessed mime: [%s] [%s]\n",
l_mime.c_str(), f.c_str()));
LOGDEB("FileInterner:: unprocessed mime: [" << (l_mime) << "] [" << (f) << "]\n" );
if (!df)
return;
}
@ -245,12 +241,12 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
df->set_docsize(docsize);
if (!df->set_document_file(l_mime, m_fn)) {
delete df;
LOGERR(("FileInterner:: error converting %s\n", m_fn.c_str()));
LOGERR("FileInterner:: error converting " << (m_fn) << "\n" );
return;
}
m_handlers.push_back(df);
LOGDEB(("FileInterner:: init ok %s [%s]\n", l_mime.c_str(), m_fn.c_str()));
LOGDEB("FileInterner:: init ok " << (l_mime) << " [" << (m_fn) << "]\n" );
m_ok = true;
}
@ -259,7 +255,7 @@ FileInterner::FileInterner(const string &data, RclConfig *cnf,
int flags, const string& imime)
: m_ok(false), m_missingdatap(0), m_uncomp((flags & FIF_forPreview) != 0)
{
LOGDEB0(("FileInterner::FileInterner(data)\n"));
LOGDEB0("FileInterner::FileInterner(data)\n" );
initcommon(cnf, flags);
init(data, cnf, flags, imime);
}
@ -268,7 +264,7 @@ void FileInterner::init(const string &data, RclConfig *cnf,
int flags, const string& imime)
{
if (imime.empty()) {
LOGERR(("FileInterner: inmemory constructor needs input mime type\n"));
LOGERR("FileInterner: inmemory constructor needs input mime type\n" );
return;
}
m_mimetype = imime;
@ -279,7 +275,7 @@ void FileInterner::init(const string &data, RclConfig *cnf,
if (!df) {
// No handler for this type, for now :( if indexallfilenames
// is set in the config, this normally wont happen (we get mh_unknown)
LOGDEB(("FileInterner:: unprocessed mime [%s]\n", m_mimetype.c_str()));
LOGDEB("FileInterner:: unprocessed mime [" << (m_mimetype) << "]\n" );
return;
}
df->set_property(Dijon::Filter::OPERATING_MODE,
@ -300,8 +296,7 @@ void FileInterner::init(const string &data, RclConfig *cnf,
}
}
if (!result) {
LOGINFO(("FileInterner:: set_doc failed inside for mtype %s\n",
m_mimetype.c_str()));
LOGINFO("FileInterner:: set_doc failed inside for mtype " << (m_mimetype) << "\n" );
delete df;
return;
}
@ -325,17 +320,17 @@ void FileInterner::initcommon(RclConfig *cnf, int flags)
FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf, int flags)
: m_ok(false), m_missingdatap(0), m_uncomp(((flags & FIF_forPreview) != 0))
{
LOGDEB0(("FileInterner::FileInterner(idoc)\n"));
LOGDEB0("FileInterner::FileInterner(idoc)\n" );
initcommon(cnf, flags);
DocFetcher *fetcher = docFetcherMake(cnf, idoc);
if (fetcher == 0) {
LOGERR(("FileInterner:: no backend\n"));
LOGERR("FileInterner:: no backend\n" );
return;
}
DocFetcher::RawDoc rawdoc;
if (!fetcher->fetch(cnf, idoc, rawdoc)) {
LOGERR(("FileInterner:: fetcher failed\n"));
LOGERR("FileInterner:: fetcher failed\n" );
return;
}
switch (rawdoc.kind) {
@ -350,7 +345,7 @@ FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf, int flags)
m_direct = true;
break;
default:
LOGERR(("FileInterner::FileInterner(idoc): bad rawdoc kind ??\n"));
LOGERR("FileInterner::FileInterner(idoc): bad rawdoc kind ??\n" );
}
return;
}
@ -359,7 +354,7 @@ bool FileInterner::makesig(RclConfig *cnf, const Rcl::Doc& idoc, string& sig)
{
DocFetcher *fetcher = docFetcherMake(cnf, idoc);
if (fetcher == 0) {
LOGERR(("FileInterner::makesig no backend for doc\n"));
LOGERR("FileInterner::makesig no backend for doc\n" );
return false;
}
@ -386,14 +381,12 @@ TempFile FileInterner::dataToTempFile(const string& dt, const string& mt)
// Create temp file with appropriate suffix for mime type
TempFile temp(new TempFileInternal(m_cfg->getSuffixFromMimeType(mt)));
if (!temp->ok()) {
LOGERR(("FileInterner::dataToTempFile: cant create tempfile: %s\n",
temp->getreason().c_str()));
LOGERR("FileInterner::dataToTempFile: cant create tempfile: " << (temp->getreason()) << "\n" );
return TempFile();
}
string reason;
if (!stringtofile(dt, temp->filename(), reason)) {
LOGERR(("FileInterner::dataToTempFile: stringtofile: %s\n",
reason.c_str()));
LOGERR("FileInterner::dataToTempFile: stringtofile: " << (reason) << "\n" );
return TempFile();
}
return temp;
@ -404,7 +397,7 @@ TempFile FileInterner::dataToTempFile(const string& dt, const string& mt)
// RECFILTERROR HELPERNOTFOUND program1 [program2 ...]
void FileInterner::checkExternalMissing(const string& msg, const string& mt)
{
LOGDEB2(("checkExternalMissing: [%s]\n", msg.c_str()));
LOGDEB2("checkExternalMissing: [" << (msg) << "]\n" );
if (m_missingdatap && msg.find("RECFILTERROR") == 0) {
vector<string> verr;
stringToStrings(msg, verr);
@ -496,10 +489,10 @@ static inline bool getKeyValue(const map<string, string>& docdata,
it = docdata.find(key);
if (it != docdata.end()) {
value = it->second;
LOGDEB2(("getKeyValue: [%s]->[%s]\n", key.c_str(), value.c_str()));
LOGDEB2("getKeyValue: [" << (key) << "]->[" << (value) << "]\n" );
return true;
}
LOGDEB2(("getKeyValue: no value for [%s]\n", key.c_str()));
LOGDEB2("getKeyValue: no value for [" << (key) << "]\n" );
return false;
}
@ -508,7 +501,7 @@ bool FileInterner::dijontorcl(Rcl::Doc& doc)
RecollFilter *df = m_handlers.back();
if (df == 0) {
//??
LOGERR(("FileInterner::dijontorcl: null top handler ??\n"));
LOGERR("FileInterner::dijontorcl: null top handler ??\n" );
return false;
}
const map<string, string>& docdata = df->get_meta_data();
@ -575,7 +568,7 @@ bool FileInterner::dijontorcl(Rcl::Doc& doc)
// actually complicated.
void FileInterner::collectIpathAndMT(Rcl::Doc& doc) const
{
LOGDEB2(("FileInterner::collectIpathAndMT\n"));
LOGDEB2("FileInterner::collectIpathAndMT\n" );
bool hasipath = false;
if (!m_noxattrs) {
@ -624,7 +617,7 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc) const
// Trim empty tail elements in ipath.
if (hasipath) {
LOGDEB2(("IPATH [%s]\n", doc.ipath.c_str()));
LOGDEB2("IPATH [" << (doc.ipath) << "]\n" );
string::size_type sit = doc.ipath.find_last_not_of(cstr_isep);
if (sit == string::npos)
doc.ipath.erase();
@ -660,8 +653,7 @@ int FileInterner::addHandler()
getKeyValue(docdata, cstr_dj_keycharset, charset);
getKeyValue(docdata, cstr_dj_keymt, mimetype);
LOGDEB(("FileInterner::addHandler: next_doc is %s target [%s]\n",
mimetype.c_str(), m_targetMType.c_str()));
LOGDEB("FileInterner::addHandler: next_doc is " << (mimetype) << " target [" << (m_targetMType) << "]\n" );
// If we find a document of the target type (text/plain in
// general), we're done decoding. If we hit text/plain, we're done
@ -669,7 +661,7 @@ int FileInterner::addHandler()
if (!stringicmp(mimetype, m_targetMType) ||
!stringicmp(mimetype, cstr_textplain)) {
m_reachedMType = mimetype;
LOGDEB1(("FileInterner::addHandler: target reached\n"));
LOGDEB1("FileInterner::addHandler: target reached\n" );
return ADD_BREAK;
}
@ -677,7 +669,7 @@ int FileInterner::addHandler()
if (m_handlers.size() >= MAXHANDLERS) {
// Stack too big. Skip this and go on to check if there is
// something else in the current back()
LOGERR(("FileInterner::addHandler: stack too high\n"));
LOGERR("FileInterner::addHandler: stack too high\n" );
return ADD_CONTINUE;
}
@ -685,8 +677,7 @@ int FileInterner::addHandler()
if (!newflt) {
// If we can't find a handler, this doc can't be handled
// but there can be other ones so we go on
LOGINFO(("FileInterner::addHandler: no filter for [%s]\n",
mimetype.c_str()));
LOGINFO("FileInterner::addHandler: no filter for [" << (mimetype) << "]\n" );
return ADD_CONTINUE;
}
newflt->set_property(Dijon::Filter::OPERATING_MODE,
@ -725,8 +716,7 @@ int FileInterner::addHandler()
}
}
if (!setres) {
LOGINFO(("FileInterner::addHandler: set_doc failed inside %s "
" for mtype %s\n", m_fn.c_str(), mimetype.c_str()));
LOGINFO("FileInterner::addHandler: set_doc failed inside " << (m_fn) << " for mtype " << (mimetype) << "\n" );
delete newflt;
if (m_forPreview)
return ADD_ERROR;
@ -734,7 +724,7 @@ int FileInterner::addHandler()
}
// add handler and go on, maybe this one will give us text...
m_handlers.push_back(newflt);
LOGDEB1(("FileInterner::addHandler: added\n"));
LOGDEB1("FileInterner::addHandler: added\n" );
return ADD_OK;
}
@ -744,21 +734,19 @@ void FileInterner::processNextDocError(Rcl::Doc &doc)
collectIpathAndMT(doc);
m_reason = m_handlers.back()->get_error();
checkExternalMissing(m_reason, doc.mimetype);
LOGERR(("FileInterner::internfile: next_document error "
"[%s%s%s] %s %s\n", m_fn.c_str(), doc.ipath.empty() ? "" : "|",
doc.ipath.c_str(), doc.mimetype.c_str(), m_reason.c_str()));
LOGERR("FileInterner::internfile: next_document error [" << (m_fn) << "" << (doc.ipath.empty() ? "" : "|") << "" << (doc.ipath) << "] " << (doc.mimetype) << " " << (m_reason) << "\n" );
}
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath)
{
LOGDEB(("FileInterner::internfile. ipath [%s]\n", ipath.c_str()));
LOGDEB("FileInterner::internfile. ipath [" << (ipath) << "]\n" );
// Get rid of possible image tempfile from older call
m_imgtmp.reset();
if (m_handlers.size() < 1) {
// Just means the constructor failed
LOGDEB(("FileInterner::internfile: no handler: constructor failed\n"));
LOGDEB("FileInterner::internfile: no handler: constructor failed\n" );
return FIError;
}
@ -777,7 +765,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
}
vipath.insert(vipath.begin(), lipath.begin(), lipath.end());
if (!m_handlers.back()->skip_to_document(vipath[m_handlers.size()-1])){
LOGERR(("FileInterner::internfile: can't skip\n"));
LOGERR("FileInterner::internfile: can't skip\n" );
return FIError;
}
}
@ -793,7 +781,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
while (!m_handlers.empty()) {
CancelCheck::instance().checkCancel();
if (loop++ > 1000) {
LOGERR(("FileInterner:: looping!\n"));
LOGERR("FileInterner:: looping!\n" );
return FIError;
}
// If there are no more docs at the current top level we pop and
@ -805,7 +793,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
if (m_forPreview) {
m_reason += "Requested document does not exist. ";
m_reason += m_handlers.back()->get_error();
LOGERR(("FileInterner: requested document does not exist\n"));
LOGERR("FileInterner: requested document does not exist\n" );
return FIError;
}
popHandler();
@ -820,7 +808,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
if (m_forPreview) {
m_reason += "Requested document does not exist. ";
m_reason += m_handlers.back()->get_error();
LOGERR(("FileInterner: requested document does not exist\n"));
LOGERR("FileInterner: requested document does not exist\n" );
return FIError;
}
popHandler();
@ -831,20 +819,20 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
// handler to stack.
switch (addHandler()) {
case ADD_OK: // Just go through: handler has been stacked, use it
LOGDEB2(("addHandler returned OK\n"));
LOGDEB2("addHandler returned OK\n" );
break;
case ADD_CONTINUE:
// forget this doc and retrieve next from current handler
// (ipath stays same)
LOGDEB2(("addHandler returned CONTINUE\n"));
LOGDEB2("addHandler returned CONTINUE\n" );
continue;
case ADD_BREAK:
// Stop looping: doc type ok, need complete its processing
// and return it
LOGDEB2(("addHandler returned BREAK\n"));
LOGDEB2("addHandler returned BREAK\n" );
goto breakloop; // when you have to you have to
case ADD_ERROR:
LOGDEB2(("addHandler returned ERROR\n"));
LOGDEB2("addHandler returned ERROR\n" );
return FIError;
}
@ -858,14 +846,14 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
if (!ipath.empty()) {
if (m_handlers.size() <= vipath.size() &&
!m_handlers.back()->skip_to_document(vipath[m_handlers.size()-1])) {
LOGERR(("FileInterner::internfile: can't skip\n"));
LOGERR("FileInterner::internfile: can't skip\n" );
return FIError;
}
}
}
breakloop:
if (m_handlers.empty()) {
LOGDEB(("FileInterner::internfile: conversion ended with no doc\n"));
LOGDEB("FileInterner::internfile: conversion ended with no doc\n" );
return FIError;
}
@ -908,7 +896,7 @@ bool FileInterner::tempFileForMT(TempFile& otemp, RclConfig* cnf,
TempFile temp(new TempFileInternal(
cnf->getSuffixFromMimeType(mimetype)));
if (!temp->ok()) {
LOGERR(("FileInterner::interntofile: can't create temp file\n"));
LOGERR("FileInterner::interntofile: can't create temp file\n" );
return false;
}
otemp = temp;
@ -934,7 +922,7 @@ bool FileInterner::tempFileForMT(TempFile& otemp, RclConfig* cnf,
bool FileInterner::idocToFile(TempFile& otemp, const string& tofile,
RclConfig *cnf, const Rcl::Doc& idoc)
{
LOGDEB(("FileInterner::idocToFile\n"));
LOGDEB("FileInterner::idocToFile\n" );
if (idoc.ipath.empty()) {
return topdocToFile(otemp, tofile, cnf, idoc);
@ -953,12 +941,12 @@ bool FileInterner::topdocToFile(TempFile& otemp, const string& tofile,
{
DocFetcher *fetcher = docFetcherMake(cnf, idoc);
if (fetcher == 0) {
LOGERR(("FileInterner::idocToFile no backend\n"));
LOGERR("FileInterner::idocToFile no backend\n" );
return false;
}
DocFetcher::RawDoc rawdoc;
if (!fetcher->fetch(cnf, idoc, rawdoc)) {
LOGERR(("FileInterner::idocToFile fetcher failed\n"));
LOGERR("FileInterner::idocToFile fetcher failed\n" );
return false;
}
const char *filename = "";
@ -975,20 +963,18 @@ bool FileInterner::topdocToFile(TempFile& otemp, const string& tofile,
switch (rawdoc.kind) {
case DocFetcher::RawDoc::RDK_FILENAME:
if (!copyfile(rawdoc.data.c_str(), filename, reason)) {
LOGERR(("FileInterner::idocToFile: copyfile: %s\n",
reason.c_str()));
LOGERR("FileInterner::idocToFile: copyfile: " << (reason) << "\n" );
return false;
}
break;
case DocFetcher::RawDoc::RDK_DATA:
if (!stringtofile(rawdoc.data, filename, reason)) {
LOGERR(("FileInterner::idocToFile: stringtofile: %s\n",
reason.c_str()));
LOGERR("FileInterner::idocToFile: stringtofile: " << (reason) << "\n" );
return false;
}
break;
default:
LOGERR(("FileInterner::FileInterner(idoc): bad rawdoc kind ??\n"));
LOGERR("FileInterner::FileInterner(idoc): bad rawdoc kind ??\n" );
}
if (tofile.empty())
@ -1000,13 +986,13 @@ bool FileInterner::interntofile(TempFile& otemp, const string& tofile,
const string& ipath, const string& mimetype)
{
if (!ok()) {
LOGERR(("FileInterner::interntofile: constructor failed\n"));
LOGERR("FileInterner::interntofile: constructor failed\n" );
return false;
}
Rcl::Doc doc;
Status ret = internfile(doc, ipath);
if (ret == FileInterner::FIError) {
LOGERR(("FileInterner::interntofile: internfile() failed\n"));
LOGERR("FileInterner::interntofile: internfile() failed\n" );
return false;
}
@ -1033,8 +1019,7 @@ bool FileInterner::interntofile(TempFile& otemp, const string& tofile,
}
string reason;
if (!stringtofile(doc.text, filename, reason)) {
LOGERR(("FileInterner::interntofile: stringtofile : %s\n",
reason.c_str()));
LOGERR("FileInterner::interntofile: stringtofile : " << (reason) << "\n" );
return false;
}
@ -1045,16 +1030,15 @@ bool FileInterner::interntofile(TempFile& otemp, const string& tofile,
bool FileInterner::isCompressed(const string& fn, RclConfig *cnf)
{
LOGDEB(("FileInterner::isCompressed: [%s]\n", fn.c_str()));
LOGDEB("FileInterner::isCompressed: [" << (fn) << "]\n" );
struct stat st;
if (path_fileprops(fn, &st) < 0) {
LOGERR(("FileInterner::isCompressed: can't stat [%s]\n", fn.c_str()));
LOGERR("FileInterner::isCompressed: can't stat [" << (fn) << "]\n" );
return false;
}
string l_mime = mimetype(fn, &st, cnf, true);
if (l_mime.empty()) {
LOGERR(("FileInterner::isUncompressed: can't get mime for [%s]\n",
fn.c_str()));
LOGERR("FileInterner::isUncompressed: can't get mime for [" << (fn) << "]\n" );
return false;
}
@ -1069,17 +1053,15 @@ bool FileInterner::isCompressed(const string& fn, RclConfig *cnf)
bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn,
RclConfig *cnf, const Rcl::Doc& doc)
{
LOGDEB(("FileInterner::maybeUncompressToTemp: [%s]\n", fn.c_str()));
LOGDEB("FileInterner::maybeUncompressToTemp: [" << (fn) << "]\n" );
struct stat st;
if (path_fileprops(fn.c_str(), &st) < 0) {
LOGERR(("FileInterner::maybeUncompressToTemp: can't stat [%s]\n",
fn.c_str()));
LOGERR("FileInterner::maybeUncompressToTemp: can't stat [" << (fn) << "]\n" );
return false;
}
string l_mime = mimetype(fn, &st, cnf, true);
if (l_mime.empty()) {
LOGERR(("FileInterner::maybeUncompress.: can't id. mime for [%s]\n",
fn.c_str()));
LOGERR("FileInterner::maybeUncompress.: can't id. mime for [" << (fn) << "]\n" );
return false;
}
@ -1091,14 +1073,13 @@ bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn,
int maxkbs = -1;
if (cnf->getConfParam("compressedfilemaxkbs", &maxkbs) &&
maxkbs >= 0 && int(st.st_size / 1024) > maxkbs) {
LOGINFO(("FileInterner:: %s over size limit %d kbs\n",
fn.c_str(), maxkbs));
LOGINFO("FileInterner:: " << (fn) << " over size limit " << (maxkbs) << " kbs\n" );
return false;
}
temp =
TempFile(new TempFileInternal(cnf->getSuffixFromMimeType(doc.mimetype)));
if (!temp->ok()) {
LOGERR(("FileInterner: cant create temporary file"));
LOGERR("FileInterner: cant create temporary file" );
return false;
}
@ -1113,9 +1094,7 @@ bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn,
// uncompressed file, hopefully staying on the same dev.
string reason;
if (!renameormove(uncomped.c_str(), temp->filename(), reason)) {
LOGERR(("FileInterner::maybeUncompress: move [%s] -> [%s] "
"failed: %s\n",
uncomped.c_str(), temp->filename(), reason.c_str()));
LOGERR("FileInterner::maybeUncompress: move [" << (uncomped) << "] -> [" << (temp->filename()) << "] failed: " << (reason) << "\n" );
return false;
}
return true;
@ -1131,7 +1110,8 @@ bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn,
using namespace std;
#include "debuglog.h"
#include "log.h"
#include "rclinit.h"
#include "internfile.h"
#include "rclconfig.h"
@ -1232,3 +1212,4 @@ int main(int argc, char **argv)
}
#endif // TEST_INTERNFILE

View file

@ -26,7 +26,7 @@
#include "execmd.h"
#include "mh_exec.h"
#include "mh_html.h"
#include "debuglog.h"
#include "log.h"
#include "cancelcheck.h"
#include "smallut.h"
#include "md5ut.h"
@ -55,11 +55,10 @@ void MEAdv::reset()
void MEAdv::newData(int n)
{
LOGDEB2(("MHExec:newData(%d)\n", n));
LOGDEB2("MHExec:newData(" << (n) << ")\n" );
if (m_filtermaxseconds > 0 &&
time(0L) - m_start > m_filtermaxseconds) {
LOGERR(("MimeHandlerExec: filter timeout (%d S)\n",
m_filtermaxseconds));
LOGERR("MimeHandlerExec: filter timeout (" << (m_filtermaxseconds) << " S)\n" );
throw HandlerTimeout();
}
// If a cancel request was set by the signal handler (or by us
@ -70,7 +69,7 @@ void MEAdv::newData(int n)
bool MimeHandlerExec::skip_to_document(const string& ipath)
{
LOGDEB(("MimeHandlerExec:skip_to_document: [%s]\n", ipath.c_str()));
LOGDEB("MimeHandlerExec:skip_to_document: [" << (ipath) << "]\n" );
m_ipath = ipath;
return true;
}
@ -83,13 +82,13 @@ bool MimeHandlerExec::next_document()
return false;
m_havedoc = false;
if (missingHelper) {
LOGDEB(("MimeHandlerExec::next_document(): helper known missing\n"));
LOGDEB("MimeHandlerExec::next_document(): helper known missing\n" );
return false;
}
if (params.empty()) {
// Hu ho
LOGERR(("MimeHandlerExec::mkDoc: empty params\n"));
LOGERR("MimeHandlerExec::mkDoc: empty params\n" );
m_reason = "RECFILTERROR BADCONFIG";
return false;
}
@ -118,16 +117,15 @@ bool MimeHandlerExec::next_document()
try {
status = mexec.doexec(cmd, myparams, 0, &output);
} catch (HandlerTimeout) {
LOGERR(("MimeHandlerExec: handler timeout\n"));
LOGERR("MimeHandlerExec: handler timeout\n" );
status = 0x110f;
} catch (CancelExcept) {
LOGERR(("MimeHandlerExec: cancelled\n"));
LOGERR("MimeHandlerExec: cancelled\n" );
status = 0x110f;
}
if (status) {
LOGERR(("MimeHandlerExec: command status 0x%x for %s\n",
status, cmd.c_str()));
LOGERR("MimeHandlerExec: command status 0x" << (status) << " for " << (cmd) << "\n" );
if (WIFEXITED(status) && WEXITSTATUS(status) == 127) {
// That's how execmd signals a failed exec (most probably
// a missing command). Let'hope no filter uses the same value as
@ -195,10 +193,10 @@ void MimeHandlerExec::finaldetails()
if (MD5File(m_fn, md5, &reason)) {
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
} else {
LOGERR(("MimeHandlerExec: cant compute md5 for [%s]: %s\n",
m_fn.c_str(), reason.c_str()));
LOGERR("MimeHandlerExec: cant compute md5 for [" << (m_fn) << "]: " << (reason) << "\n" );
}
}
handle_cs(m_metaData[cstr_dj_keymt]);
}

View file

@ -23,7 +23,7 @@ using namespace std;
#include "cstr.h"
#include "mh_execm.h"
#include "mh_html.h"
#include "debuglog.h"
#include "log.h"
#include "cancelcheck.h"
#include "smallut.h"
#include "md5ut.h"
@ -36,10 +36,10 @@ using namespace std;
bool MimeHandlerExecMultiple::startCmd()
{
LOGDEB(("MimeHandlerExecMultiple::startCmd\n"));
LOGDEB("MimeHandlerExecMultiple::startCmd\n" );
if (params.empty()) {
// Hu ho
LOGERR(("MHExecMultiple::startCmd: empty params\n"));
LOGERR("MHExecMultiple::startCmd: empty params\n" );
m_reason = "RECFILTERROR BADCONFIG";
return false;
}
@ -86,15 +86,15 @@ bool MimeHandlerExecMultiple::readDataElement(string& name, string &data)
// Read name and length
if (m_cmd.getline(ibuf) <= 0) {
LOGERR(("MHExecMultiple: getline error\n"));
LOGERR("MHExecMultiple: getline error\n" );
return false;
}
LOGDEB1(("MHEM:rde: line [%s]\n", ibuf.c_str()));
LOGDEB1("MHEM:rde: line [" << (ibuf) << "]\n" );
// Empty line (end of message) ?
if (!ibuf.compare("\n")) {
LOGDEB(("MHExecMultiple: Got empty line\n"));
LOGDEB("MHExecMultiple: Got empty line\n" );
name.clear();
return true;
}
@ -112,8 +112,7 @@ bool MimeHandlerExecMultiple::readDataElement(string& name, string &data)
vector<string> tokens;
stringToTokens(ibuf, tokens);
if (tokens.size() != 2) {
LOGERR(("MHExecMultiple: bad line in filter output: [%s]\n",
ibuf.c_str()));
LOGERR("MHExecMultiple: bad line in filter output: [" << (ibuf) << "]\n" );
return false;
}
vector<string>::iterator it = tokens.begin();
@ -121,13 +120,12 @@ bool MimeHandlerExecMultiple::readDataElement(string& name, string &data)
string& slen = *it;
int len;
if (sscanf(slen.c_str(), "%d", &len) != 1) {
LOGERR(("MHExecMultiple: bad line in filter output: [%s]\n",
ibuf.c_str()));
LOGERR("MHExecMultiple: bad line in filter output: [" << (ibuf) << "]\n" );
return false;
}
if (len / 1024 > m_maxmemberkb) {
LOGERR(("MHExecMultiple: data len > maxmemberkb\n"));
LOGERR("MHExecMultiple: data len > maxmemberkb\n" );
return false;
}
@ -144,24 +142,23 @@ bool MimeHandlerExecMultiple::readDataElement(string& name, string &data)
// Read element data
datap->erase();
if (len > 0 && m_cmd.receive(*datap, len) != len) {
LOGERR(("MHExecMultiple: expected %d bytes of data, got %d\n",
len, datap->length()));
LOGERR("MHExecMultiple: expected " << (len) << " bytes of data, got " << (datap->length()) << "\n" );
return false;
}
LOGDEB1(("MHExecMe:rdDtElt got: name [%s] len %d value [%s]\n",
name.c_str(), len, datap->size() > 100 ?
(datap->substr(0, 100) + " ...").c_str() : datap->c_str()));
LOGDEB1("MHExecMe:rdDtElt got: name [" << name << "] len " << len <<
"value [" << (datap->size() > 100 ?
(datap->substr(0, 100) + " ...") : datap) << endl);
return true;
}
bool MimeHandlerExecMultiple::next_document()
{
LOGDEB(("MimeHandlerExecMultiple::next_document(): [%s]\n", m_fn.c_str()));
LOGDEB("MimeHandlerExecMultiple::next_document(): [" << (m_fn) << "]\n" );
if (m_havedoc == false)
return false;
if (missingHelper) {
LOGDEB(("MHExecMultiple::next_document(): helper known missing\n"));
LOGDEB("MHExecMultiple::next_document(): helper known missing\n" );
return false;
}
@ -185,8 +182,7 @@ bool MimeHandlerExecMultiple::next_document()
if (MD5File(m_fn, md5, &reason)) {
file_md5 = MD5HexPrint(md5, xmd5);
} else {
LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n",
m_fn.c_str(), reason.c_str()));
LOGERR("MimeHandlerExecM: cant compute md5 for [" << (m_fn) << "]: " << (reason) << "\n" );
}
}
obuf << "FileName: " << m_fn.length() << "\n" << m_fn;
@ -196,8 +192,7 @@ bool MimeHandlerExecMultiple::next_document()
obuf << "Filename: " << 0 << "\n";
}
if (!m_ipath.empty()) {
LOGDEB(("next_doc: sending len %d val [%s]\n", m_ipath.length(),
m_ipath.c_str()));
LOGDEB("next_doc: sending len " << (m_ipath.length()) << " val [" << (m_ipath) << "]\n" );
obuf << "Ipath: " << m_ipath.length() << "\n" << m_ipath;
}
if (!m_dfltInputCharset.empty()) {
@ -208,14 +203,14 @@ bool MimeHandlerExecMultiple::next_document()
obuf << "\n";
if (m_cmd.send(obuf.str()) < 0) {
m_cmd.zapChild();
LOGERR(("MHExecMultiple: send error\n"));
LOGERR("MHExecMultiple: send error\n" );
return false;
}
m_adv.reset();
// Read answer (multiple elements)
LOGDEB1(("MHExecMultiple: reading answer\n"));
LOGDEB1("MHExecMultiple: reading answer\n" );
bool eofnext_received = false;
bool eofnow_received = false;
bool fileerror_received = false;
@ -231,47 +226,46 @@ bool MimeHandlerExecMultiple::next_document()
return false;
}
} catch (HandlerTimeout) {
LOGINFO(("MHExecMultiple: timeout\n"));
LOGINFO("MHExecMultiple: timeout\n" );
m_cmd.zapChild();
return false;
} catch (CancelExcept) {
LOGINFO(("MHExecMultiple: interrupt\n"));
LOGINFO("MHExecMultiple: interrupt\n" );
m_cmd.zapChild();
return false;
}
if (name.empty())
break;
if (!stringlowercmp("eofnext:", name)) {
LOGDEB(("MHExecMultiple: got EOFNEXT\n"));
LOGDEB("MHExecMultiple: got EOFNEXT\n" );
eofnext_received = true;
} else if (!stringlowercmp("eofnow:", name)) {
LOGDEB(("MHExecMultiple: got EOFNOW\n"));
LOGDEB("MHExecMultiple: got EOFNOW\n" );
eofnow_received = true;
} else if (!stringlowercmp("fileerror:", name)) {
LOGDEB(("MHExecMultiple: got FILEERROR\n"));
LOGDEB("MHExecMultiple: got FILEERROR\n" );
fileerror_received = true;
} else if (!stringlowercmp("subdocerror:", name)) {
LOGDEB(("MHExecMultiple: got SUBDOCERROR\n"));
LOGDEB("MHExecMultiple: got SUBDOCERROR\n" );
subdocerror_received = true;
} else if (!stringlowercmp("ipath:", name)) {
ipath = data;
LOGDEB(("MHExecMultiple: got ipath [%s]\n", data.c_str()));
LOGDEB("MHExecMultiple: got ipath [" << (data) << "]\n" );
} else if (!stringlowercmp("charset:", name)) {
charset = data;
LOGDEB(("MHExecMultiple: got charset [%s]\n", data.c_str()));
LOGDEB("MHExecMultiple: got charset [" << (data) << "]\n" );
} else if (!stringlowercmp("mimetype:", name)) {
mtype = data;
LOGDEB(("MHExecMultiple: got mimetype [%s]\n", data.c_str()));
LOGDEB("MHExecMultiple: got mimetype [" << (data) << "]\n" );
} else {
string nm = stringtolower((const string&)name);
trimstring(nm, ":");
LOGDEB(("MHExecMultiple: got [%s] -> [%s]\n", nm.c_str(),
data.c_str()));
LOGDEB("MHExecMultiple: got [" << (nm) << "] -> [" << (data) << "]\n" );
m_metaData[nm] += data;
}
if (loop == 20) {
// ??
LOGERR(("MHExecMultiple: filter sent too many parameters\n"));
LOGERR("MHExecMultiple: filter sent too many parameters\n" );
return false;
}
}
@ -289,8 +283,7 @@ bool MimeHandlerExecMultiple::next_document()
// this was wrong. Empty documents can be found ie in zip files and should
// not be interpreted as eof.
if (m_metaData[cstr_dj_keycontent].empty()) {
LOGDEB0(("MHExecMultiple: got empty document inside [%s]: [%s]\n",
m_fn.c_str(), ipath.c_str()));
LOGDEB0("MHExecMultiple: got empty document inside [" << (m_fn) << "]: [" << (ipath) << "]\n" );
}
if (!ipath.empty()) {
@ -300,8 +293,7 @@ bool MimeHandlerExecMultiple::next_document()
// string which we can use to compute a mime type
m_metaData[cstr_dj_keyipath] = ipath;
if (mtype.empty()) {
LOGDEB0(("MHExecMultiple: no mime type from filter, "
"using ipath for a guess\n"));
LOGDEB0("MHExecMultiple: no mime type from filter, using ipath for a guess\n" );
mtype = mimetype(ipath, 0, m_config, false);
if (mtype.empty()) {
// mimetype() won't call idFile when there is no file. Do it
@ -310,7 +302,7 @@ bool MimeHandlerExecMultiple::next_document()
// Note this happens for example for directory zip members
// We could recognize them by the end /, but wouldn't know
// what to do with them anyway.
LOGINFO(("MHExecMultiple: cant guess mime type\n"));
LOGINFO("MHExecMultiple: cant guess mime type\n" );
mtype = "application/octet-stream";
}
}
@ -335,10 +327,7 @@ bool MimeHandlerExecMultiple::next_document()
if (eofnext_received)
m_havedoc = false;
LOGDEB0(("MHExecMultiple: returning %d bytes of content,"
" mtype [%s] charset [%s]\n",
m_metaData[cstr_dj_keycontent].size(),
m_metaData[cstr_dj_keymt].c_str(),
m_metaData[cstr_dj_keycharset].c_str()));
LOGDEB0("MHExecMultiple: returning " << (m_metaData[cstr_dj_keycontent].size()) << " bytes of content, mtype [" << (m_metaData[cstr_dj_keymt]) << "] charset [" << (m_metaData[cstr_dj_keycharset]) << "]\n" );
return true;
}

View file

@ -17,7 +17,7 @@
#include "cstr.h"
#include "mimehandler.h"
#include "debuglog.h"
#include "log.h"
#include "readfile.h"
#include "transcode.h"
#include "mimeparse.h"
@ -36,11 +36,11 @@ using namespace std;
bool MimeHandlerHtml::set_document_file(const string& mt, const string &fn)
{
LOGDEB0(("textHtmlToDoc: %s\n", fn.c_str()));
LOGDEB0("textHtmlToDoc: " << (fn) << "\n" );
RecollFilter::set_document_file(mt, fn);
string otext;
if (!file_to_string(fn, otext)) {
LOGINFO(("textHtmlToDoc: cant read: %s\n", fn.c_str()));
LOGINFO("textHtmlToDoc: cant read: " << (fn) << "\n" );
return false;
}
m_filename = fn;
@ -73,14 +73,12 @@ bool MimeHandlerHtml::next_document()
m_filename.erase();
string charset = m_dfltInputCharset;
LOGDEB(("MHHtml::next_doc.: default supposed input charset: [%s]\n",
charset.c_str()));
LOGDEB("MHHtml::next_doc.: default supposed input charset: [" << (charset) << "]\n" );
// Override default input charset if someone took care to set one:
map<string,string>::const_iterator it = m_metaData.find(cstr_dj_keycharset);
if (it != m_metaData.end() && !it->second.empty()) {
charset = it->second;
LOGDEB(("MHHtml: next_doc.: input charset from ext. metadata: [%s]\n",
charset.c_str()));
LOGDEB("MHHtml: next_doc.: input charset from ext. metadata: [" << (charset) << "]\n" );
}
// - We first try to convert from the supposed charset
@ -93,14 +91,13 @@ bool MimeHandlerHtml::next_document()
MyHtmlParser result;
for (int pass = 0; pass < 2; pass++) {
string transcoded;
LOGDEB(("Html::mkDoc: pass %d\n", pass));
LOGDEB("Html::mkDoc: pass " << (pass) << "\n" );
MyHtmlParser p;
// Try transcoding. If it fails, use original text.
int ecnt;
if (!transcode(m_html, transcoded, charset, "UTF-8", &ecnt)) {
LOGDEB(("textHtmlToDoc: transcode failed from cs '%s' to UTF-8 for"
"[%s]", charset.c_str(), fn.empty()?"unknown":fn.c_str()));
LOGDEB("textHtmlToDoc: transcode failed from cs '" << (charset) << "' to UTF-8 for[" << (fn.empty()?"unknown":fn) << "]" );
transcoded = m_html;
// We don't know the charset, at all
p.reset_charsets();
@ -108,11 +105,9 @@ bool MimeHandlerHtml::next_document()
} else {
if (ecnt) {
if (pass == 0) {
LOGDEB(("textHtmlToDoc: init transcode had %d errors for "
"[%s]\n", ecnt, fn.empty()?"unknown":fn.c_str()));
LOGDEB("textHtmlToDoc: init transcode had " << (ecnt) << " errors for [" << (fn.empty()?"unknown":fn) << "]\n" );
} else {
LOGERR(("textHtmlToDoc: final transcode had %d errors for "
"[%s]\n", ecnt, fn.empty()?"unknown":fn.c_str()));
LOGERR("textHtmlToDoc: final transcode had " << (ecnt) << " errors for [" << (fn.empty()?"unknown":fn) << "]\n" );
}
}
// charset has the putative source charset, transcoded is now
@ -150,16 +145,15 @@ bool MimeHandlerHtml::next_document()
break;
}
LOGDEB(("textHtmlToDoc: charset [%s] doc charset [%s]\n",
charset.c_str(), result.get_charset().c_str()));
LOGDEB("textHtmlToDoc: charset [" << (charset) << "] doc charset [" << (result.get_charset()) << "]\n" );
if (!result.get_charset().empty() &&
!samecharset(result.get_charset(), result.fromcharset)) {
LOGDEB(("textHtmlToDoc: reparse for charsets\n"));
LOGDEB("textHtmlToDoc: reparse for charsets\n" );
// Set the origin charset as specified in document before
// transcoding again
charset = result.get_charset();
} else {
LOGERR(("textHtmlToDoc:: error: non charset exception\n"));
LOGERR("textHtmlToDoc:: error: non charset exception\n" );
return false;
}
}
@ -181,3 +175,4 @@ bool MimeHandlerHtml::next_document()
}
return true;
}

View file

@ -33,7 +33,7 @@
#include "transcode.h"
#include "mimeparse.h"
#include "mh_mail.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "mh_html.h"
#include "rclconfig.h"
@ -89,7 +89,7 @@ void MimeHandlerMail::clear()
bool MimeHandlerMail::set_document_file(const string& mt, const string &fn)
{
LOGDEB(("MimeHandlerMail::set_document_file(%s)\n", fn.c_str()));
LOGDEB("MimeHandlerMail::set_document_file(" << (fn) << ")\n" );
RecollFilter::set_document_file(mt, fn);
if (m_fd >= 0) {
close(m_fd);
@ -103,14 +103,12 @@ bool MimeHandlerMail::set_document_file(const string& mt, const string &fn)
if (MD5File(fn, md5, &reason)) {
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
} else {
LOGERR(("MimeHandlerMail: cant md5 [%s]: %s\n", fn.c_str(),
reason.c_str()));
LOGERR("MimeHandlerMail: cant md5 [" << (fn) << "]: " << (reason) << "\n" );
}
}
m_fd = open(fn.c_str(), 0);
if (m_fd < 0) {
LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
fn.c_str(), errno));
LOGERR("MimeHandlerMail::set_document_file: open(" << (fn) << ") errno " << (errno) << "\n" );
return false;
}
#if defined O_NOATIME && O_NOATIME != 0
@ -122,8 +120,7 @@ bool MimeHandlerMail::set_document_file(const string& mt, const string &fn)
m_bincdoc = new Binc::MimeDocument;
m_bincdoc->parseFull(m_fd);
if (!m_bincdoc->isHeaderParsed() && !m_bincdoc->isAllParsed()) {
LOGERR(("MimeHandlerMail::mkDoc: mime parse error for %s\n",
fn.c_str()));
LOGERR("MimeHandlerMail::mkDoc: mime parse error for " << (fn) << "\n" );
return false;
}
m_havedoc = true;
@ -133,8 +130,8 @@ bool MimeHandlerMail::set_document_file(const string& mt, const string &fn)
bool MimeHandlerMail::set_document_string(const string& mt,
const string &msgtxt)
{
LOGDEB1(("MimeHandlerMail::set_document_string\n"));
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
LOGDEB1("MimeHandlerMail::set_document_string\n" );
LOGDEB2("Message text: [" << (msgtxt) << "]\n" );
RecollFilter::set_document_string(mt, msgtxt);
delete m_stream;
@ -145,19 +142,17 @@ bool MimeHandlerMail::set_document_string(const string& mt,
}
if ((m_stream = new stringstream(msgtxt)) == 0 || !m_stream->good()) {
LOGERR(("MimeHandlerMail::set_document_string: stream create error."
"msgtxt.size() %d\n", int(msgtxt.size())));
LOGERR("MimeHandlerMail::set_document_string: stream create error.msgtxt.size() " << (int(msgtxt.size())) << "\n" );
return false;
}
delete m_bincdoc;
if ((m_bincdoc = new Binc::MimeDocument) == 0) {
LOGERR(("MimeHandlerMail::set_doc._string: new Binc:Document failed."
" Out of memory?"));
LOGERR("MimeHandlerMail::set_doc._string: new Binc:Document failed. Out of memory?" );
return false;
}
m_bincdoc->parseFull(*m_stream);
if (!m_bincdoc->isHeaderParsed() && !m_bincdoc->isAllParsed()) {
LOGERR(("MimeHandlerMail::set_document_string: mime parse error\n"));
LOGERR("MimeHandlerMail::set_document_string: mime parse error\n" );
return false;
}
m_havedoc = true;
@ -166,14 +161,14 @@ bool MimeHandlerMail::set_document_string(const string& mt,
bool MimeHandlerMail::skip_to_document(const string& ipath)
{
LOGDEB(("MimeHandlerMail::skip_to_document(%s)\n", ipath.c_str()));
LOGDEB("MimeHandlerMail::skip_to_document(" << (ipath) << ")\n" );
if (m_idx == -1) {
// No decoding done yet. If ipath is null need do nothing
if (ipath.empty() || ipath == "-1")
return true;
// ipath points to attachment: need to decode message
if (!next_document()) {
LOGERR(("MimeHandlerMail::skip_to_doc: next_document failed\n"));
LOGERR("MimeHandlerMail::skip_to_doc: next_document failed\n" );
return false;
}
}
@ -183,8 +178,7 @@ bool MimeHandlerMail::skip_to_document(const string& ipath)
bool MimeHandlerMail::next_document()
{
LOGDEB(("MimeHandlerMail::next_document m_idx %d m_havedoc %d\n",
m_idx, m_havedoc));
LOGDEB("MimeHandlerMail::next_document m_idx " << (m_idx) << " m_havedoc " << (m_havedoc) << "\n" );
if (!m_havedoc)
return false;
bool res = false;
@ -192,8 +186,7 @@ bool MimeHandlerMail::next_document()
if (m_idx == -1) {
m_metaData[cstr_dj_keymt] = cstr_textplain;
res = processMsg(m_bincdoc, 0);
LOGDEB1(("MimeHandlerMail::next_document: mt %s, att cnt %d\n",
m_metaData[cstr_dj_keymt].c_str(), m_attachments.size()));
LOGDEB1("MimeHandlerMail::next_document: mt " << (m_metaData[cstr_dj_keymt]) << ", att cnt " << (m_attachments.size()) << "\n" );
const string& txt = m_metaData[cstr_dj_keycontent];
if (m_startoftext < txt.size())
m_metaData[cstr_dj_keyabstract] =
@ -228,16 +221,16 @@ static bool decodeBody(const string& cte, // Content transfer encoding
if (!stringlowercmp("quoted-printable", cte)) {
if (!qp_decode(body, decoded)) {
LOGERR(("decodeBody: quoted-printable decoding failed !\n"));
LOGDEB((" Body: \n%s\n", body.c_str()));
LOGERR("decodeBody: quoted-printable decoding failed !\n" );
LOGDEB(" Body: \n" << (body) << "\n" );
return false;
}
*respp = &decoded;
} else if (!stringlowercmp("base64", cte)) {
if (!base64_decode(body, decoded)) {
// base64 encoding errors are actually relatively common
LOGERR(("decodeBody: base64 decoding failed !\n"));
LOGDEB((" Body: \n%s\n", body.c_str()));
LOGERR("decodeBody: base64 decoding failed !\n" );
LOGDEB(" Body: \n" << (body) << "\n" );
return false;
}
*respp = &decoded;
@ -247,7 +240,7 @@ static bool decodeBody(const string& cte, // Content transfer encoding
bool MimeHandlerMail::processAttach()
{
LOGDEB(("MimeHandlerMail::processAttach() m_idx %d\n", m_idx));
LOGDEB("MimeHandlerMail::processAttach() m_idx " << (m_idx) << "\n" );
if (!m_havedoc)
return false;
if (m_idx >= (int)m_attachments.size()) {
@ -261,10 +254,7 @@ bool MimeHandlerMail::processAttach()
m_metaData[cstr_dj_keycharset] = att->m_charset;
m_metaData[cstr_dj_keyfn] = att->m_filename;
m_metaData[cstr_dj_keytitle] = att->m_filename + " (" + m_subject + ")";
LOGDEB1((" processAttach:ct [%s] cs [%s] fn [%s]\n",
att->m_contentType.c_str(),
att->m_charset.c_str(),
att->m_filename.c_str()));
LOGDEB1(" processAttach:ct [" << (att->m_contentType) << "] cs [" << (att->m_charset) << "] fn [" << (att->m_filename) << "]\n" );
// Erase current content and replace
m_metaData[cstr_dj_keycontent] = string();
@ -315,11 +305,10 @@ bool MimeHandlerMail::processAttach()
// text
bool MimeHandlerMail::processMsg(Binc::MimePart *doc, int depth)
{
LOGDEB2(("MimeHandlerMail::processMsg: depth %d\n", depth));
LOGDEB2("MimeHandlerMail::processMsg: depth " << (depth) << "\n" );
if (depth++ >= maxdepth) {
// Have to stop somewhere
LOGINFO(("MimeHandlerMail::processMsg: maxdepth %d exceeded\n",
maxdepth));
LOGINFO("MimeHandlerMail::processMsg: maxdepth " << (maxdepth) << " exceeded\n" );
// Return true anyway, better to index partially than not at all
return true;
}
@ -371,7 +360,7 @@ bool MimeHandlerMail::processMsg(Binc::MimePart *doc, int depth)
m_metaData[cstr_dj_keymd] = ascuxtime;
} else {
// Leave mtime field alone, ftime will be used instead.
LOGDEB(("rfc2822Date...: failed: [%s]\n", decoded.c_str()));
LOGDEB("rfc2822Date...: failed: [" << (decoded) << "]\n" );
}
}
if (preview())
@ -405,12 +394,10 @@ bool MimeHandlerMail::processMsg(Binc::MimePart *doc, int depth)
text += '\n';
m_startoftext = text.size();
LOGDEB2(("MimeHandlerMail::processMsg:ismultipart %d mime subtype '%s'\n",
doc->isMultipart(), doc->getSubType().c_str()));
LOGDEB2("MimeHandlerMail::processMsg:ismultipart " << (doc->isMultipart()) << " mime subtype '" << (doc->getSubType()) << "'\n" );
walkmime(doc, depth);
LOGDEB2(("MimeHandlerMail::processMsg:text:[%s]\n",
m_metaData[cstr_dj_keycontent].c_str()));
LOGDEB2("MimeHandlerMail::processMsg:text:[" << (m_metaData[cstr_dj_keycontent]) << "]\n" );
return true;
}
@ -426,17 +413,16 @@ bool MimeHandlerMail::processMsg(Binc::MimePart *doc, int depth)
// message/rfc822 may also be of interest.
void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
{
LOGDEB2(("MimeHandlerMail::walkmime: depth %d\n", depth));
LOGDEB2("MimeHandlerMail::walkmime: depth " << (depth) << "\n" );
if (depth++ >= maxdepth) {
LOGINFO(("walkmime: max depth (%d) exceeded\n", maxdepth));
LOGINFO("walkmime: max depth (" << (maxdepth) << ") exceeded\n" );
return;
}
string& out = m_metaData[cstr_dj_keycontent];
if (doc->isMultipart()) {
LOGDEB2(("walkmime: ismultipart %d subtype '%s'\n",
doc->isMultipart(), doc->getSubType().c_str()));
LOGDEB2("walkmime: ismultipart " << (doc->isMultipart()) << " subtype '" << (doc->getSubType()) << "'\n" );
// We only handle alternative, related and mixed (no digests).
std::vector<Binc::MimePart>::iterator it;
@ -459,22 +445,22 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
// Get and parse content-type header
Binc::HeaderItem hi;
if (!it->h.getFirstHeader("Content-Type", hi)) {
LOGDEB(("walkmime:no ctent-type header for part %d\n", i));
LOGDEB("walkmime:no ctent-type header for part " << (i) << "\n" );
continue;
}
MimeHeaderValue content_type;
parseMimeHeaderValue(hi.getValue(), content_type);
LOGDEB2(("walkmime: C-type: %s\n",content_type.value.c_str()));
LOGDEB2("walkmime: C-type: " << (content_type.value) << "\n" );
if (!stringlowercmp(cstr_textplain, content_type.value))
ittxt = it;
else if (!stringlowercmp("text/html", content_type.value))
ithtml = it;
}
if (ittxt != doc->members.end()) {
LOGDEB2(("walkmime: alternative: chose text/plain part\n"))
LOGDEB2("walkmime: alternative: chose text/plain part\n" );
walkmime(&(*ittxt), depth);
} else if (ithtml != doc->members.end()) {
LOGDEB2(("walkmime: alternative: chose text/html part\n"))
LOGDEB2("walkmime: alternative: chose text/html part\n" );
walkmime(&(*ithtml), depth);
}
}
@ -490,7 +476,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
if (doc->h.getFirstHeader("Content-Type", hi)) {
ctt = hi.getValue();
}
LOGDEB2(("walkmime:content-type: %s\n", ctt.c_str()));
LOGDEB2("walkmime:content-type: " << (ctt) << "\n" );
MimeHeaderValue content_type;
parseMimeHeaderValue(ctt, content_type);
@ -501,7 +487,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
}
MimeHeaderValue content_disposition;
parseMimeHeaderValue(ctd, content_disposition);
LOGDEB2(("Content_disposition:[%s]\n", content_disposition.value.c_str()));
LOGDEB2("Content_disposition:[" << (content_disposition.value) << "]\n" );
string dispindic;
if (stringlowercmp("inline", content_disposition.value))
dispindic = "Attachment";
@ -521,7 +507,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
}
if (doc->isMessageRFC822()) {
LOGDEB2(("walkmime: message/RFC822 part\n"));
LOGDEB2("walkmime: message/RFC822 part\n" );
// The first part is the already parsed message. Call
// processMsg instead of walkmime so that mail headers get
@ -542,7 +528,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
}
// "Simple" part.
LOGDEB2(("walkmime: simple part\n"));
LOGDEB2("walkmime: simple part\n" );
// Normally the default charset is us-ascii. But it happens that 8
// bit chars exist in a message that is stated as us-ascii. Ie the
// mailer used by yahoo support ('KANA') does this. We could
@ -589,7 +575,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
}
MHMailAttach *att = new MHMailAttach;
if (att == 0) {
LOGERR(("Out of memory\n"));
LOGERR("Out of memory\n" );
return;
}
att->m_contentType = content_type.value;
@ -598,11 +584,7 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
att->m_charset = charset;
att->m_contentTransferEncoding = cte;
att->m_part = doc;
LOGDEB(("walkmime: attachmnt: ct [%s] cte [%s] cs [%s] fn [%s]\n",
att->m_contentType.c_str(),
att->m_contentTransferEncoding.c_str(),
att->m_charset.c_str(),
filename.c_str()));
LOGDEB("walkmime: attachmnt: ct [" << (att->m_contentType) << "] cte [" << (att->m_contentTransferEncoding) << "] cs [" << (att->m_charset) << "] fn [" << (filename) << "]\n" );
m_attachments.push_back(att);
return;
}
@ -612,15 +594,14 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
// filter stack work: this would create another subdocument, but
// we want instead to decode a body part of this message document.
LOGDEB2(("walkmime: final: body start offset %d, length %d\n",
doc->getBodyStartOffset(), doc->getBodyLength()));
LOGDEB2("walkmime: final: body start offset " << (doc->getBodyStartOffset()) << ", length " << (doc->getBodyLength()) << "\n" );
string body;
doc->getBody(body, 0, doc->bodylength);
{
string decoded;
const string *bdp;
if (!decodeBody(cte, body, decoded, &bdp)) {
LOGERR(("MimeHandlerMail::walkmime: failed decoding body\n"));
LOGERR("MimeHandlerMail::walkmime: failed decoding body\n" );
}
if (bdp != &body)
body.swap(decoded);
@ -641,10 +622,9 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
} else {
string utf8;
// Transcode to utf-8
LOGDEB1(("walkmime: transcoding from %s to UTF-8\n", charset.c_str()));
LOGDEB1("walkmime: transcoding from " << (charset) << " to UTF-8\n" );
if (!transcode(body, utf8, charset, cstr_utf8)) {
LOGERR(("walkmime: transcode failed from cs '%s' to UTF-8\n",
charset.c_str()));
LOGERR("walkmime: transcode failed from cs '" << (charset) << "' to UTF-8\n" );
out += body;
} else {
out += utf8;
@ -654,5 +634,6 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth)
if (out.length() && out[out.length()-1] != '\n')
out += '\n';
LOGDEB2(("walkmime: out now: [%s]\n", out.c_str()));
LOGDEB2("walkmime: out now: [" << (out) << "]\n" );
}

View file

@ -38,7 +38,7 @@
#include "cstr.h"
#include "mimehandler.h"
#include "debuglog.h"
#include "log.h"
#include "readfile.h"
#include "mh_mbox.h"
#include "smallut.h"
@ -100,47 +100,43 @@ public:
~MboxCache() {}
mbhoff_type get_offset(RclConfig *config, const string& udi, int msgnum)
{
LOGDEB0(("MboxCache::get_offsets: udi [%s] msgnum %d\n", udi.c_str(),
msgnum));
LOGDEB0("MboxCache::get_offsets: udi [" << (udi) << "] msgnum " << (msgnum) << "\n" );
if (!ok(config)) {
LOGDEB0(("MboxCache::get_offsets: init failed\n"));
LOGDEB0("MboxCache::get_offsets: init failed\n" );
return -1;
}
PTMutexLocker locker(o_mcache_mutex);
string fn = makefilename(udi);
FILE *fp = 0;
if ((fp = fopen(fn.c_str(), "r")) == 0) {
LOGDEB(("MboxCache::get_offsets: open failed, errno %d\n", errno));
LOGDEB("MboxCache::get_offsets: open failed, errno " << (errno) << "\n" );
return -1;
}
FpKeeper keeper(&fp);
char blk1[M_o_b1size];
if (fread(blk1, 1, o_b1size, fp) != o_b1size) {
LOGDEB0(("MboxCache::get_offsets: read blk1 errno %d\n", errno));
LOGDEB0("MboxCache::get_offsets: read blk1 errno " << (errno) << "\n" );
return -1;
}
ConfSimple cf(string(blk1, o_b1size));
string fudi;
if (!cf.get("udi", fudi) || fudi.compare(udi)) {
LOGINFO(("MboxCache::get_offset:badudi fn %s udi [%s], fudi [%s]\n",
fn.c_str(), udi.c_str(), fudi.c_str()));
LOGINFO("MboxCache::get_offset:badudi fn " << (fn) << " udi [" << (udi) << "], fudi [" << (fudi) << "]\n" );
return -1;
}
if (fseeko(fp, cacheoffset(msgnum), SEEK_SET) != 0) {
LOGDEB0(("MboxCache::get_offsets: seek %s errno %d\n",
lltodecstr(cacheoffset(msgnum)).c_str(), errno));
LOGDEB0("MboxCache::get_offsets: seek " << (lltodecstr(cacheoffset(msgnum))) << " errno " << (errno) << "\n" );
return -1;
}
mbhoff_type offset = -1;
size_t ret;
if ((ret = fread(&offset, 1, sizeof(mbhoff_type), fp))
!= sizeof(mbhoff_type)) {
LOGDEB0(("MboxCache::get_offsets: read ret %d errno %d\n",
ret, errno));
LOGDEB0("MboxCache::get_offsets: read ret " << (ret) << " errno " << (errno) << "\n" );
return -1;
}
LOGDEB0(("MboxCache::get_offsets: ret %s\n", lltodecstr(offset).c_str()));
LOGDEB0("MboxCache::get_offsets: ret " << (lltodecstr(offset)) << "\n" );
return offset;
}
@ -148,7 +144,7 @@ public:
void put_offsets(RclConfig *config, const string& udi, mbhoff_type fsize,
vector<mbhoff_type>& offs)
{
LOGDEB0(("MboxCache::put_offsets: %u offsets\n", offs.size()));
LOGDEB0("MboxCache::put_offsets: " << (offs.size()) << " offsets\n" );
if (!ok(config) || !maybemakedir())
return;
if (fsize < m_minfsize)
@ -157,7 +153,7 @@ public:
string fn = makefilename(udi);
FILE *fp;
if ((fp = fopen(fn.c_str(), "w")) == 0) {
LOGDEB(("MboxCache::put_offsets: fopen errno %d\n", errno));
LOGDEB("MboxCache::put_offsets: fopen errno " << (errno) << "\n" );
return;
}
FpKeeper keeper(&fp);
@ -167,7 +163,7 @@ public:
blk1.append(cstr_newline);
blk1.resize(o_b1size, 0);
if (fwrite(blk1.c_str(), 1, o_b1size, fp) != o_b1size) {
LOGDEB(("MboxCache::put_offsets: fwrite errno %d\n", errno));
LOGDEB("MboxCache::put_offsets: fwrite errno " << (errno) << "\n" );
return;
}
@ -261,7 +257,7 @@ void MimeHandlerMbox::clear()
bool MimeHandlerMbox::set_document_file(const string& mt, const string &fn)
{
LOGDEB(("MimeHandlerMbox::set_document_file(%s)\n", fn.c_str()));
LOGDEB("MimeHandlerMbox::set_document_file(" << (fn) << ")\n" );
RecollFilter::set_document_file(mt, fn);
m_fn = fn;
if (m_vfp) {
@ -271,8 +267,7 @@ bool MimeHandlerMbox::set_document_file(const string& mt, const string &fn)
m_vfp = fopen(fn.c_str(), "r");
if (m_vfp == 0) {
LOGERR(("MimeHandlerMail::set_document_file: error opening %s\n",
fn.c_str()));
LOGERR("MimeHandlerMail::set_document_file: error opening " << (fn) << "\n" );
return false;
}
#if defined O_NOATIME && O_NOATIME != 0
@ -283,8 +278,7 @@ bool MimeHandlerMbox::set_document_file(const string& mt, const string &fn)
// Used to use ftell() here: no good beyond 2GB
{struct stat st;
if (fstat(fileno((FILE*)m_vfp), &st) < 0) {
LOGERR(("MimeHandlerMbox:setdocfile: fstat(%s) failed errno %d\n",
fn.c_str(), errno));
LOGERR("MimeHandlerMbox:setdocfile: fstat(" << (fn) << ") failed errno " << (errno) << "\n" );
return false;
}
m_fsize = st.st_size;
@ -297,7 +291,7 @@ bool MimeHandlerMbox::set_document_file(const string& mt, const string &fn)
string quirks;
if (m_config && m_config->getConfParam(cstr_keyquirks, quirks)) {
if (quirks == "tbird") {
LOGDEB(("MimeHandlerMbox: setting quirks TBIRD\n"));
LOGDEB("MimeHandlerMbox: setting quirks TBIRD\n" );
m_quirks |= MBOXQUIRK_TBIRD;
}
}
@ -305,8 +299,7 @@ bool MimeHandlerMbox::set_document_file(const string& mt, const string &fn)
// And double check for thunderbird
string tbirdmsf = fn + ".msf";
if ((m_quirks&MBOXQUIRK_TBIRD) == 0 && path_exists(tbirdmsf)) {
LOGDEB(("MimeHandlerMbox: detected unconfigured tbird mbox in %s\n",
fn.c_str()));
LOGDEB("MimeHandlerMbox: detected unconfigured tbird mbox in " << (fn) << "\n" );
m_quirks |= MBOXQUIRK_TBIRD;
}
@ -423,7 +416,7 @@ static void compileregexes()
bool MimeHandlerMbox::next_document()
{
if (m_vfp == 0) {
LOGERR(("MimeHandlerMbox::next_document: not open\n"));
LOGERR("MimeHandlerMbox::next_document: not open\n" );
return false;
}
if (!m_havedoc) {
@ -435,11 +428,10 @@ bool MimeHandlerMbox::next_document()
sscanf(m_ipath.c_str(), "%d", &mtarg);
} else if (m_forPreview) {
// Can't preview an mbox.
LOGDEB(("MimeHandlerMbox::next_document: can't preview folders!\n"));
LOGDEB("MimeHandlerMbox::next_document: can't preview folders!\n" );
return false;
}
LOGDEB0(("MimeHandlerMbox::next_document: fn %s, msgnum %d mtarg %d \n",
m_fn.c_str(), m_msgnum, mtarg));
LOGDEB0("MimeHandlerMbox::next_document: fn " << (m_fn) << ", msgnum " << (m_msgnum) << " mtarg " << (mtarg) << " \n" );
if (mtarg == 0)
mtarg = -1;
@ -459,8 +451,7 @@ bool MimeHandlerMbox::next_document()
if (mtarg > 0) {
mbhoff_type off;
line_type line;
LOGDEB0(("MimeHandlerMbox::next_doc: mtarg %d m_udi[%s]\n",
mtarg, m_udi.c_str()));
LOGDEB0("MimeHandlerMbox::next_doc: mtarg " << (mtarg) << " m_udi[" << (m_udi) << "]\n" );
if (!m_udi.empty() &&
(off = o_mcache.get_offset(m_config, m_udi, mtarg)) >= 0 &&
fseeko(fp, (off_t)off, SEEK_SET) >= 0 &&
@ -468,7 +459,7 @@ bool MimeHandlerMbox::next_document()
(!M_regexec(fromregex, line, 0, 0, 0) ||
((m_quirks & MBOXQUIRK_TBIRD) &&
!M_regexec(minifromregex, line, 0, 0, 0))) ) {
LOGDEB0(("MimeHandlerMbox: Cache: From_ Ok\n"));
LOGDEB0("MimeHandlerMbox: Cache: From_ Ok\n" );
fseeko(fp, (off_t)off, SEEK_SET);
m_msgnum = mtarg -1;
storeoffsets = false;
@ -487,7 +478,7 @@ bool MimeHandlerMbox::next_document()
for (;;) {
message_end = ftello(fp);
if (!fgets(line, LL, fp)) {
LOGDEB2(("MimeHandlerMbox:next: eof\n"));
LOGDEB2("MimeHandlerMbox:next: eof\n" );
iseof = true;
m_msgnum++;
break;
@ -495,8 +486,7 @@ bool MimeHandlerMbox::next_document()
m_lineno++;
int ll;
stripendnl(line, ll);
LOGDEB2(("mhmbox:next: hadempty %d lineno %d ll %d Line: [%s]\n",
hademptyline, m_lineno, ll, line));
LOGDEB2("mhmbox:next: hadempty " << (hademptyline) << " lineno " << (m_lineno) << " ll " << (ll) << " Line: [" << (line) << "]\n" );
if (hademptyline) {
if (ll > 0) {
// Non-empty line with empty line flag set, reset flag
@ -514,8 +504,7 @@ bool MimeHandlerMbox::next_document()
((m_quirks & MBOXQUIRK_TBIRD) &&
!M_regexec(minifromregex, line, 0, 0, 0)))
) {
LOGDEB0(("MimeHandlerMbox: msgnum %d, "
"From_ at line %d: [%s]\n", m_msgnum, m_lineno, line));
LOGDEB0("MimeHandlerMbox: msgnum " << (m_msgnum) << ", From_ at line " << (m_lineno) << ": [" << (line) << "]\n" );
if (storeoffsets)
m_offsets.push_back(message_end);
m_msgnum++;
@ -538,15 +527,13 @@ bool MimeHandlerMbox::next_document()
line[ll+1] = 0;
msgtxt += line;
if (msgtxt.size() > max_mbox_member_size) {
LOGERR(("mh_mbox: huge message (more than %u MB) inside %s,"
" giving up\n", max_mbox_member_size/(1024*1024),
m_fn.c_str()));
LOGERR("mh_mbox: huge message (more than " << (max_mbox_member_size/(1024*1024)) << " MB) inside " << (m_fn) << ", giving up\n" );
return false;
}
}
}
LOGDEB2(("Message text length %d\n", msgtxt.size()));
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
LOGDEB2("Message text length " << (msgtxt.size()) << "\n" );
LOGDEB2("Message text: [" << (msgtxt) << "]\n" );
char buf[20];
// m_msgnum was incremented when hitting the next From_ or eof, so the data
// is for m_msgnum - 1
@ -554,7 +541,7 @@ bool MimeHandlerMbox::next_document()
m_metaData[cstr_dj_keyipath] = buf;
m_metaData[cstr_dj_keymt] = "message/rfc822";
if (iseof) {
LOGDEB2(("MimeHandlerMbox::next: eof hit\n"));
LOGDEB2("MimeHandlerMbox::next: eof hit\n" );
m_havedoc = false;
if (!m_udi.empty() && storeoffsets) {
o_mcache.put_offsets(m_config, m_udi, m_fsize, m_offsets);
@ -679,3 +666,4 @@ int main(int argc, char **argv)
#endif // TEST_MH_MBOX

View file

@ -25,7 +25,7 @@
#include "mimehandler.h"
#include "transcode.h"
#include "pathut.h"
#include "debuglog.h"
#include "log.h"
/** Index symlink target
*
@ -61,8 +61,7 @@ class MimeHandlerSymlink : public RecollFilter {
transcode(path_getsimple(slc), m_metaData[cstr_dj_keycontent],
m_config->getDefCharset(true), "UTF-8");
} else {
LOGDEB(("Symlink: readlink [%s] failed, errno %d\n", m_fn.c_str(),
errno));
LOGDEB("Symlink: readlink [" << (m_fn) << "] failed, errno " << (errno) << "\n" );
}
m_metaData[cstr_dj_keymt] = cstr_textplain;
return true;
@ -72,3 +71,4 @@ private:
};
#endif /* _MH_SYMLINK_H_INCLUDED_ */

View file

@ -27,7 +27,7 @@
#include "cstr.h"
#include "mh_text.h"
#include "debuglog.h"
#include "log.h"
#include "readfile.h"
#include "md5ut.h"
#include "rclconfig.h"
@ -42,8 +42,7 @@ const int KB = 1024;
// Process a plain text file
bool MimeHandlerText::set_document_file(const string& mt, const string &fn)
{
LOGDEB(("MimeHandlerText::set_document_file: [%s] offs %s\n",
fn.c_str(), lltodecstr(m_offs).c_str()));
LOGDEB("MimeHandlerText::set_document_file: [" << (fn) << "] offs " << (lltodecstr(m_offs)) << "\n" );
RecollFilter::set_document_file(mt, fn);
@ -55,8 +54,7 @@ bool MimeHandlerText::set_document_file(const string& mt, const string &fn)
// file size for oversize check
long long fsize = path_filesize(m_fn);
if (fsize < 0) {
LOGERR(("MimeHandlerText::set_document_file: stat %s errno %d\n",
m_fn.c_str(), errno));
LOGERR("MimeHandlerText::set_document_file: stat " << (m_fn) << " errno " << (errno) << "\n" );
return false;
}
@ -111,8 +109,7 @@ bool MimeHandlerText::skip_to_document(const string& ipath)
char *endptr;
long long t = strtoll(ipath.c_str(), &endptr, 10);
if (endptr == ipath.c_str()) {
LOGERR(("MimeHandlerText::skip_to_document: bad ipath offs [%s]\n",
ipath.c_str()));
LOGERR("MimeHandlerText::skip_to_document: bad ipath offs [" << (ipath) << "]\n" );
return false;
}
m_offs = (off_t)t;
@ -122,7 +119,7 @@ bool MimeHandlerText::skip_to_document(const string& ipath)
bool MimeHandlerText::next_document()
{
LOGDEB(("MimeHandlerText::next_document: m_havedoc %d\n", int(m_havedoc)));
LOGDEB("MimeHandlerText::next_document: m_havedoc " << (int(m_havedoc)) << "\n" );
if (m_havedoc == false)
return false;
@ -175,7 +172,7 @@ bool MimeHandlerText::readnext()
string reason;
m_text.clear();
if (!file_to_string(m_fn, m_text, m_offs, m_pagesz, &reason)) {
LOGERR(("MimeHandlerText: can't read file: %s\n", reason.c_str()));
LOGERR("MimeHandlerText: can't read file: " << (reason) << "\n" );
m_havedoc = false;
return false;
}
@ -197,3 +194,4 @@ bool MimeHandlerText::readnext()
m_offs += m_text.length();
return true;
}

View file

@ -27,7 +27,7 @@ using namespace std;
#include "cstr.h"
#include "mimehandler.h"
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "smallut.h"
#include "md5ut.h"
@ -60,8 +60,7 @@ static RecollFilter *getMimeHandlerFromCache(const string& key)
PTMutexLocker locker(o_handlers_mutex);
string xdigest;
MD5HexPrint(key, xdigest);
LOGDEB(("getMimeHandlerFromCache: %s cache size %u\n",
xdigest.c_str(), o_handlers.size()));
LOGDEB("getMimeHandlerFromCache: " << (xdigest) << " cache size " << (o_handlers.size()) << "\n" );
multimap<string, RecollFilter *>::iterator it = o_handlers.find(key);
if (it != o_handlers.end()) {
@ -70,14 +69,13 @@ static RecollFilter *getMimeHandlerFromCache(const string& key)
if (it1 != o_hlru.end()) {
o_hlru.erase(it1);
} else {
LOGERR(("getMimeHandlerFromCache: lru position not found\n"));
LOGERR("getMimeHandlerFromCache: lru position not found\n" );
}
o_handlers.erase(it);
LOGDEB(("getMimeHandlerFromCache: %s found size %u\n",
xdigest.c_str(), o_handlers.size()));
LOGDEB("getMimeHandlerFromCache: " << (xdigest) << " found size " << (o_handlers.size()) << "\n" );
return h;
}
LOGDEB(("getMimeHandlerFromCache: %s not found\n", xdigest.c_str()));
LOGDEB("getMimeHandlerFromCache: " << (xdigest) << " not found\n" );
return 0;
}
@ -87,15 +85,14 @@ void returnMimeHandler(RecollFilter *handler)
typedef multimap<string, RecollFilter*>::value_type value_type;
if (handler == 0) {
LOGERR(("returnMimeHandler: bad parameter\n"));
LOGERR("returnMimeHandler: bad parameter\n" );
return;
}
handler->clear();
PTMutexLocker locker(o_handlers_mutex);
LOGDEB(("returnMimeHandler: returning filter for %s cache size %d\n",
handler->get_mime_type().c_str(), o_handlers.size()));
LOGDEB("returnMimeHandler: returning filter for " << (handler->get_mime_type()) << " cache size " << (o_handlers.size()) << "\n" );
// Limit pool size. The pool can grow quite big because there are
// many filter types, each of which can be used in several copies
@ -108,9 +105,9 @@ void returnMimeHandler(RecollFilter *handler)
if (once) {
once = 0;
for (it = o_handlers.begin(); it != o_handlers.end(); it++) {
LOGDEB1(("Cache full. key: %s\n", it->first.c_str()));
LOGDEB1("Cache full. key: " << (it->first) << "\n" );
}
LOGDEB1(("Cache LRU size: %u\n", o_hlru.size()));
LOGDEB1("Cache LRU size: " << (o_hlru.size()) << "\n" );
}
if (o_hlru.size() > 0) {
it = o_hlru.back();
@ -125,7 +122,7 @@ void returnMimeHandler(RecollFilter *handler)
void clearMimeHandlerCache()
{
LOGDEB(("clearMimeHandlerCache()\n"));
LOGDEB("clearMimeHandlerCache()\n" );
multimap<string, RecollFilter *>::iterator it;
PTMutexLocker locker(o_handlers_mutex);
for (it = o_handlers.begin(); it != o_handlers.end(); it++) {
@ -139,31 +136,31 @@ void clearMimeHandlerCache()
static RecollFilter *mhFactory(RclConfig *config, const string &mime,
bool nobuild, string& id)
{
LOGDEB2(("mhFactory(%s)\n", mime.c_str()));
LOGDEB2("mhFactory(" << (mime) << ")\n" );
string lmime(mime);
stringtolower(lmime);
if (cstr_textplain == lmime) {
LOGDEB2(("mhFactory(%s): returning MimeHandlerText\n", mime.c_str()));
LOGDEB2("mhFactory(" << (mime) << "): returning MimeHandlerText\n" );
MD5String("MimeHandlerText", id);
return nobuild ? 0 : new MimeHandlerText(config, id);
} else if ("text/html" == lmime) {
LOGDEB2(("mhFactory(%s): returning MimeHandlerHtml\n", mime.c_str()));
LOGDEB2("mhFactory(" << (mime) << "): returning MimeHandlerHtml\n" );
MD5String("MimeHandlerHtml", id);
return nobuild ? 0 : new MimeHandlerHtml(config, id);
} else if ("text/x-mail" == lmime) {
LOGDEB2(("mhFactory(%s): returning MimeHandlerMbox\n", mime.c_str()));
LOGDEB2("mhFactory(" << (mime) << "): returning MimeHandlerMbox\n" );
MD5String("MimeHandlerMbox", id);
return nobuild ? 0 : new MimeHandlerMbox(config, id);
} else if ("message/rfc822" == lmime) {
LOGDEB2(("mhFactory(%s): returning MimeHandlerMail\n", mime.c_str()));
LOGDEB2("mhFactory(" << (mime) << "): returning MimeHandlerMail\n" );
MD5String("MimeHandlerMail", id);
return nobuild ? 0 : new MimeHandlerMail(config, id);
} else if ("inode/symlink" == lmime) {
LOGDEB2(("mhFactory(%s): ret MimeHandlerSymlink\n", mime.c_str()));
LOGDEB2("mhFactory(" << (mime) << "): ret MimeHandlerSymlink\n" );
MD5String("MimeHandlerSymlink", id);
return nobuild ? 0 : new MimeHandlerSymlink(config, id);
} else if ("application/x-zerosize" == lmime) {
LOGDEB(("mhFactory(%s): ret MimeHandlerNull\n", mime.c_str()));
LOGDEB("mhFactory(" << (mime) << "): ret MimeHandlerNull\n" );
MD5String("MimeHandlerNull", id);
return nobuild ? 0 : new MimeHandlerNull(config, id);
} else if (lmime.find("text/") == 0) {
@ -172,15 +169,14 @@ static RecollFilter *mhFactory(RclConfig *config, const string &mime,
// mimeconf, not at random. For programs, for example this
// allows indexing and previewing as text/plain (no filter
// exec) but still opening with a specific editor.
LOGDEB2(("mhFactory(%s): returning MimeHandlerText(x)\n",mime.c_str()));
LOGDEB2("mhFactory(" << (mime) << "): returning MimeHandlerText(x)\n" );
MD5String("MimeHandlerText", id);
return nobuild ? 0 : new MimeHandlerText(config, id);
} else {
// We should not get there. It means that "internal" was set
// as a handler in mimeconf for a mime type we actually can't
// handle.
LOGERR(("mhFactory: mime type [%s] set as internal but unknown\n",
lmime.c_str()));
LOGERR("mhFactory: mime type [" << (lmime) << "] set as internal but unknown\n" );
MD5String("MimeHandlerUnknown", id);
return nobuild ? 0 : new MimeHandlerUnknown(config, id);
}
@ -203,8 +199,7 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
string cmdstr;
if (!cfg->valueSplitAttributes(hs, cmdstr, attrs)) {
LOGERR(("mhExecFactory: bad config line for [%s]: [%s]\n",
mtype.c_str(), hs.c_str()));
LOGERR("mhExecFactory: bad config line for [" << (mtype) << "]: [" << (hs) << "]\n" );
return 0;
}
@ -212,8 +207,7 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
vector<string> cmdtoks;
stringToStrings(cmdstr, cmdtoks);
if (cmdtoks.empty()) {
LOGERR(("mhExecFactory: bad config line for [%s]: [%s]\n",
mtype.c_str(), hs.c_str()));
LOGERR("mhExecFactory: bad config line for [" << (mtype) << "]: [" << (hs) << "]\n" );
return 0;
}
MimeHandlerExec *h = multiple ?
@ -227,8 +221,7 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
// the same change if we ever want to use the same cmdling as windows
if (!stringlowercmp("python", *it) || !stringlowercmp("perl", *it)) {
if (cmdtoks.size() < 2) {
LOGERR(("mhExecFactory: python/perl cmd: no script?. [%s]: [%s]\n",
mtype.c_str(), hs.c_str()));
LOGERR("mhExecFactory: python/perl cmd: no script?. [" << (mtype) << "]: [" << (hs) << "]\n" );
}
vector<string>::iterator it1(it);
it1++;
@ -251,9 +244,7 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
for (it = h->params.begin(); it != h->params.end(); it++) {
scmd += string("[") + *it + "] ";
}
LOGDEB(("mhExecFactory:mt [%s] cfgmt [%s] cfgcs [%s] cmd: [%s]\n",
mtype.c_str(), h->cfgFilterOutputMtype.c_str(), h->cfgFilterOutputCharset.c_str(),
scmd.c_str()));
LOGDEB("mhExecFactory:mt [" << (mtype) << "] cfgmt [" << (h->cfgFilterOutputMtype) << "] cfgcs [" << (h->cfgFilterOutputCharset) << "] cmd: [" << (scmd) << "]\n" );
#endif
return h;
@ -263,8 +254,7 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
RecollFilter *getMimeHandler(const string &mtype, RclConfig *cfg,
bool filtertypes)
{
LOGDEB(("getMimeHandler: mtype [%s] filtertypes %d\n",
mtype.c_str(), filtertypes));
LOGDEB("getMimeHandler: mtype [" << (mtype) << "] filtertypes " << (filtertypes) << "\n" );
RecollFilter *h = 0;
// Get handler definition for mime type. We do this even if an
@ -297,18 +287,12 @@ RecollFilter *getMimeHandler(const string &mtype, RclConfig *cfg,
MD5String(hs, id);
}
#if 0
{ // string xdigest; LOGDEB2(("getMimeHandler: [%s] hs [%s] id [%s]\n",
//mtype.c_str(), hs.c_str(), MD5HexPrint(id, xdigest).c_str()));
}
#endif
// Do we already have a handler object in the cache ?
h = getMimeHandlerFromCache(id);
if (h != 0)
goto out;
LOGDEB2(("getMimeHandler: %s not in cache\n", mtype.c_str()));
LOGDEB2("getMimeHandler: " << (mtype) << " not in cache\n" );
// Not in cache.
if (internal) {
@ -319,14 +303,13 @@ RecollFilter *getMimeHandler(const string &mtype, RclConfig *cfg,
// partly redundant with the localfields/rclaptg, but
// better and the latter will probably go away at some
// point in the future.
LOGDEB2(("handlertype internal, cmdstr [%s]\n", cmdstr.c_str()));
LOGDEB2("handlertype internal, cmdstr [" << (cmdstr) << "]\n" );
h = mhFactory(cfg, cmdstr.empty() ? mtype : cmdstr, false, id);
goto out;
} else if (!stringlowercmp("dll", handlertype)) {
} else {
if (cmdstr.empty()) {
LOGERR(("getMimeHandler: bad line for %s: %s\n",
mtype.c_str(), hs.c_str()));
LOGERR("getMimeHandler: bad line for " << (mtype) << ": " << (hs) << "\n" );
goto out;
}
if (!stringlowercmp("exec", handlertype)) {
@ -336,8 +319,7 @@ RecollFilter *getMimeHandler(const string &mtype, RclConfig *cfg,
h = mhExecFactory(cfg, mtype, cmdstr, true, id);
goto out;
} else {
LOGERR(("getMimeHandler: bad line for %s: %s\n",
mtype.c_str(), hs.c_str()));
LOGERR("getMimeHandler: bad line for " << (mtype) << ": " << (hs) << "\n" );
goto out;
}
}
@ -380,3 +362,4 @@ bool canIntern(const std::string mtype, RclConfig *cfg)
return false;
return true;
}

View file

@ -37,7 +37,7 @@
#include "mimeparse.h"
#include "smallut.h"
#include "cancelcheck.h"
#include "debuglog.h"
#include "log.h"
#include "transcode.h"
static const string cstr_html_charset("charset");
@ -193,7 +193,7 @@ MyHtmlParser::MyHtmlParser()
void MyHtmlParser::decode_entities(string &s)
{
LOGDEB2(("MyHtmlParser::decode_entities\n"));
LOGDEB2("MyHtmlParser::decode_entities\n" );
// This has no meaning whatsoever if the character encoding is unknown,
// so don't do it. If charset known, caller has converted text to utf-8,
// and this is also how we translate entities
@ -261,14 +261,7 @@ void MyHtmlParser::decode_entities(string &s)
void
MyHtmlParser::process_text(const string &text)
{
LOGDEB2(("process_text: title %d script %d style %d pre %d "
"pending_space %d txt [%s]\n",
in_title_tag,
in_script_tag,
in_style_tag,
in_pre_tag,
pending_space,
text.c_str()));
LOGDEB2("process_text: title " << (in_title_tag) << " script " << (in_script_tag) << " style " << (in_style_tag) << " pre " << (in_pre_tag) << " pending_space " << (pending_space) << " txt [" << (text) << "]\n" );
CancelCheck::instance().checkCancel();
if (!in_script_tag && !in_style_tag) {
@ -307,7 +300,7 @@ MyHtmlParser::process_text(const string &text)
bool
MyHtmlParser::opening_tag(const string &tag)
{
LOGDEB2(("opening_tag: [%s]\n", tag.c_str()));
LOGDEB2("opening_tag: [" << (tag) << "]\n" );
#if 0
cout << "TAG: " << tag << ": " << endl;
map<string, string>::const_iterator x;
@ -419,10 +412,7 @@ MyHtmlParser::opening_tag(const string &tag)
charset = k->second;
if (!charset.empty() &&
!samecharset(charset, fromcharset)) {
LOGDEB1(("Doc http-equiv charset '%s' "
"differs from dir deflt '%s'\n",
charset.c_str(),
fromcharset.c_str()));
LOGDEB1("Doc http-equiv charset '" << (charset) << "' differs from dir deflt '" << (fromcharset) << "'\n" );
throw false;
}
}
@ -436,10 +426,7 @@ MyHtmlParser::opening_tag(const string &tag)
charset = newcharset;
if (!charset.empty() &&
!samecharset(charset, fromcharset)) {
LOGDEB1(("Doc html5 charset '%s' "
"differs from dir deflt '%s'\n",
charset.c_str(),
fromcharset.c_str()));
LOGDEB1("Doc html5 charset '" << (charset) << "' differs from dir deflt '" << (fromcharset) << "'\n" );
throw false;
}
}
@ -494,7 +481,7 @@ MyHtmlParser::opening_tag(const string &tag)
bool
MyHtmlParser::closing_tag(const string &tag)
{
LOGDEB2(("closing_tag: [%s]\n", tag.c_str()));
LOGDEB2("closing_tag: [" << (tag) << "]\n" );
if (tag.empty()) return true;
switch (tag[0]) {
case 'a':
@ -592,3 +579,4 @@ void
MyHtmlParser::do_eof()
{
}

View file

@ -18,7 +18,7 @@
#include "cstr.h"
#include "transcode.h"
#include "mimehandler.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
@ -33,8 +33,7 @@ static bool alternate_decode(const string& in, string& out)
{
string lang = localelang();
string code = langtocode(lang);
LOGDEB(("RecollFilter::txtdcode: trying alternate decode from %s\n",
code.c_str()));
LOGDEB("RecollFilter::txtdcode: trying alternate decode from " << (code) << "\n" );
int ecnt;
bool ret = transcode(in, out, code, cstr_utf8, &ecnt);
return ecnt > 5 ? false : ret;
@ -43,22 +42,18 @@ static bool alternate_decode(const string& in, string& out)
bool RecollFilter::txtdcode(const string& who)
{
if (m_metaData[cstr_dj_keymt].compare(cstr_textplain)) {
LOGERR(("%s::txtdcode: called on non txt/plain: %s\n", who.c_str(),
m_metaData[cstr_dj_keymt].c_str()));
LOGERR("" << (who) << "::txtdcode: called on non txt/plain: " << (m_metaData[cstr_dj_keymt]) << "\n" );
return false;
}
string& ocs = m_metaData[cstr_dj_keyorigcharset];
string& itext = m_metaData[cstr_dj_keycontent];
LOGDEB1(("%s::txtdcode: %d bytes from [%s] to UTF-8\n",
who.c_str(), itext.size(), ocs.c_str()));
LOGDEB1("" << (who) << "::txtdcode: " << (itext.size()) << " bytes from [" << (ocs) << "] to UTF-8\n" );
int ecnt;
string otext;
bool ret = transcode(itext, otext, ocs, cstr_utf8, &ecnt);
if (!ret || ecnt > int(itext.size() / 100)) {
LOGERR(("%s::txtdcode: transcode %d bytes to UTF-8 failed "
"for input charset [%s] ret %d ecnt %d\n",
who.c_str(), itext.size(), ocs.c_str(), ret, ecnt));
LOGERR("" << (who) << "::txtdcode: transcode " << (itext.size()) << " bytes to UTF-8 failed for input charset [" << (ocs) << "] ret " << (ret) << " ecnt " << (ecnt) << "\n" );
if (samecharset(ocs, cstr_utf8)) {
ret = alternate_decode(itext, otext);
@ -66,7 +61,7 @@ bool RecollFilter::txtdcode(const string& who)
ret = false;
}
if (!ret) {
LOGDEB(("txtdcode: failed. Doc is not text?\n"));
LOGDEB("txtdcode: failed. Doc is not text?\n" );
itext.erase();
return false;
}
@ -77,3 +72,4 @@ bool RecollFilter::txtdcode(const string& who)
return true;
}

View file

@ -24,7 +24,7 @@
#include <map>
#include "uncomp.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "execmd.h"
#include "pathut.h"
@ -57,7 +57,7 @@ bool Uncomp::uncompressfile(const string& ifn,
}
// Make sure tmp dir is empty. we guarantee this to filters
if (!m_dir || !m_dir->ok() || !m_dir->wipe()) {
LOGERR(("uncompressfile: can't clear temp dir %s\n", m_dir->dirname()));
LOGERR("uncompressfile: can't clear temp dir " << (m_dir->dirname()) << "\n" );
return false;
}
@ -66,14 +66,12 @@ bool Uncomp::uncompressfile(const string& ifn,
int pc;
long long availmbs;
if (!fsocc(m_dir->dirname(), &pc, &availmbs)) {
LOGERR(("uncompressfile: can't retrieve avail space for %s\n",
m_dir->dirname()));
LOGERR("uncompressfile: can't retrieve avail space for " << (m_dir->dirname()) << "\n" );
// Hope for the best
} else {
long long fsize = path_filesize(ifn);
if (fsize < 0) {
LOGERR(("uncompressfile: stat input file %s errno %d\n",
ifn.c_str(), errno));
LOGERR("uncompressfile: stat input file " << (ifn) << " errno " << (errno) << "\n" );
return false;
}
// We need at least twice the file size for the uncompressed
@ -85,10 +83,7 @@ bool Uncomp::uncompressfile(const string& ifn,
long long filembs = fsize / (1024 * 1024);
if (availmbs < 2 * filembs + 1) {
LOGERR(("uncompressfile. %s MBs available in %s not enough "
"to uncompress %s of size %s mbs\n",
lltodecstr(availmbs).c_str(), m_dir->dirname(),
ifn.c_str(), lltodecstr(filembs).c_str()));
LOGERR("uncompressfile. " << (lltodecstr(availmbs)) << " MBs available in " << (m_dir->dirname()) << " not enough to uncompress " << (ifn) << " of size " << (lltodecstr(filembs)) << " mbs\n" );
return false;
}
}
@ -112,10 +107,9 @@ bool Uncomp::uncompressfile(const string& ifn,
ExecCmd ex;
int status = ex.doexec(cmd, args, 0, &tfile);
if (status || tfile.empty()) {
LOGERR(("uncompressfile: doexec: failed for [%s] status 0x%x\n",
ifn.c_str(), status));
LOGERR("uncompressfile: doexec: failed for [" << (ifn) << "] status 0x" << (status) << "\n" );
if (!m_dir->wipe()) {
LOGERR(("uncompressfile: wipedir failed\n"));
LOGERR("uncompressfile: wipedir failed\n" );
}
return false;
}
@ -139,3 +133,4 @@ Uncomp::~Uncomp()
}
}

View file

@ -36,7 +36,7 @@
#include "rclconfig.h"
#include "pathut.h"
#include "rclinit.h"
#include "debuglog.h"
#include "log.h"
#include "wasatorcl.h"
#include "internfile.h"
#include "wipedir.h"
@ -238,3 +238,4 @@ extern "C" {
ZEND_GET_MODULE(recoll)
}
#endif

View file

@ -25,7 +25,7 @@
#include <string>
using namespace std;
#include "debuglog.h"
#include "log.h"
#include "rcldoc.h"
#include "internfile.h"
#include "rclconfig.h"
@ -49,7 +49,7 @@ typedef struct {
static void
Extractor_dealloc(rclx_ExtractorObject *self)
{
LOGDEB(("Extractor_dealloc\n"));
LOGDEB("Extractor_dealloc\n" );
delete self->xtr;
Py_TYPE(self)->tp_free((PyObject*)self);
}
@ -57,7 +57,7 @@ Extractor_dealloc(rclx_ExtractorObject *self)
static PyObject *
Extractor_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
LOGDEB(("Extractor_new\n"));
LOGDEB("Extractor_new\n" );
rclx_ExtractorObject *self =
(rclx_ExtractorObject *)type->tp_alloc(type, 0);
if (self == 0)
@ -70,7 +70,7 @@ Extractor_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static int
Extractor_init(rclx_ExtractorObject *self, PyObject *args, PyObject *kwargs)
{
LOGDEB(("Extractor_init\n"));
LOGDEB("Extractor_init\n" );
static const char* kwlist[] = {"doc", NULL};
PyObject *pdobj;
@ -99,7 +99,7 @@ static PyObject *
Extractor_textextract(rclx_ExtractorObject* self, PyObject *args,
PyObject *kwargs)
{
LOGDEB(("Extractor_textextract\n"));
LOGDEB("Extractor_textextract\n" );
static const char* kwlist[] = {"ipath", NULL};
char *sipath = 0;
@ -153,7 +153,7 @@ static PyObject *
Extractor_idoctofile(rclx_ExtractorObject* self, PyObject *args,
PyObject *kwargs)
{
LOGDEB(("Extractor_idoctofile\n"));
LOGDEB("Extractor_idoctofile\n" );
static const char* kwlist[] = {"ipath", "mimetype", "ofilename", NULL};
char *sipath = 0;
char *smt = 0;
@ -359,3 +359,4 @@ initrclextract(void)
return module;
#endif
}

View file

@ -34,7 +34,7 @@ using namespace std;
#include "pathut.h"
#include "rclutil.h"
#include "wasatorcl.h"
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include "plaintorich.h"
#include "hldata.h"
@ -62,8 +62,7 @@ typedef struct {
static void
SearchData_dealloc(recoll_SearchDataObject *self)
{
LOGDEB(("SearchData_dealloc. Releasing. Count before: %d\n",
self->sd.use_count()));
LOGDEB("SearchData_dealloc. Releasing. Count before: " << (self->sd.use_count()) << "\n" );
self->sd.reset();
Py_TYPE(self)->tp_free((PyObject*)self);
}
@ -71,7 +70,7 @@ SearchData_dealloc(recoll_SearchDataObject *self)
static PyObject *
SearchData_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
LOGDEB(("SearchData_new\n"));
LOGDEB("SearchData_new\n" );
recoll_SearchDataObject *self;
self = (recoll_SearchDataObject *)type->tp_alloc(type, 0);
@ -90,7 +89,7 @@ PyDoc_STRVAR(doc_SearchDataObject,
static int
SearchData_init(recoll_SearchDataObject *self, PyObject *args, PyObject *kwargs)
{
LOGDEB(("SearchData_init\n"));
LOGDEB("SearchData_init\n" );
static const char* kwlist[] = {"type", "stemlang", NULL};
char *stp = 0;
char *steml = 0;
@ -180,9 +179,9 @@ static PyObject *
SearchData_addclause(recoll_SearchDataObject* self, PyObject *args,
PyObject *kwargs)
{
LOGDEB0(("SearchData_addclause\n"));
LOGDEB0("SearchData_addclause\n" );
if (!self->sd) {
LOGERR(("SearchData_addclause: not init??\n"));
LOGERR("SearchData_addclause: not init??\n" );
PyErr_SetString(PyExc_AttributeError, "sd");
return 0;
}
@ -294,7 +293,7 @@ SearchData_addclause(recoll_SearchDataObject* self, PyObject *args,
static void
Doc_dealloc(recoll_DocObject *self)
{
LOGDEB(("Doc_dealloc\n"));
LOGDEB("Doc_dealloc\n" );
if (self->doc)
the_docs.erase(self->doc);
deleteZ(self->doc);
@ -304,7 +303,7 @@ Doc_dealloc(recoll_DocObject *self)
static PyObject *
Doc_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
LOGDEB(("Doc_new\n"));
LOGDEB("Doc_new\n" );
recoll_DocObject *self;
self = (recoll_DocObject *)type->tp_alloc(type, 0);
@ -318,7 +317,7 @@ Doc_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static int
Doc_init(recoll_DocObject *self, PyObject *, PyObject *)
{
LOGDEB(("Doc_init\n"));
LOGDEB("Doc_init\n" );
if (self->doc)
the_docs.erase(self->doc);
delete self->doc;
@ -340,7 +339,7 @@ PyDoc_STRVAR(doc_Doc_getbinurl,
static PyObject *
Doc_getbinurl(recoll_DocObject *self)
{
LOGDEB0(("Doc_getbinurl\n"));
LOGDEB0("Doc_getbinurl\n" );
if (self->doc == 0 ||
the_docs.find(self->doc) == the_docs.end()) {
PyErr_SetString(PyExc_AttributeError, "doc");
@ -359,7 +358,7 @@ PyDoc_STRVAR(doc_Doc_setbinurl,
static PyObject *
Doc_setbinurl(recoll_DocObject *self, PyObject *value)
{
LOGDEB0(("Doc_setbinurl\n"));
LOGDEB0("Doc_setbinurl\n" );
if (self->doc == 0 ||
the_docs.find(self->doc) == the_docs.end()) {
PyErr_SetString(PyExc_AttributeError, "doc??");
@ -381,7 +380,7 @@ PyDoc_STRVAR(doc_Doc_keys,
static PyObject *
Doc_keys(recoll_DocObject *self)
{
LOGDEB0(("Doc_keys\n"));
LOGDEB0("Doc_keys\n" );
if (self->doc == 0 ||
the_docs.find(self->doc) == the_docs.end()) {
PyErr_SetString(PyExc_AttributeError, "doc");
@ -406,7 +405,7 @@ PyDoc_STRVAR(doc_Doc_items,
static PyObject *
Doc_items(recoll_DocObject *self)
{
LOGDEB0(("Doc_items\n"));
LOGDEB0("Doc_items\n" );
if (self->doc == 0 ||
the_docs.find(self->doc) == the_docs.end()) {
PyErr_SetString(PyExc_AttributeError, "doc");
@ -436,7 +435,7 @@ PyDoc_STRVAR(doc_Doc_get,
static PyObject *
Doc_get(recoll_DocObject *self, PyObject *args)
{
LOGDEB0(("Doc_get\n"));
LOGDEB0("Doc_get\n" );
char *sutf8 = 0; // needs freeing
if (!PyArg_ParseTuple(args, "es:Doc_get",
"utf-8", &sutf8)) {
@ -490,7 +489,7 @@ static PyMethodDef Doc_methods[] = {
static PyObject *
Doc_getattro(recoll_DocObject *self, PyObject *nameobj)
{
LOGDEB0(("Doc_getattro\n"));
LOGDEB0("Doc_getattro\n" );
if (self->doc == 0 || the_docs.find(self->doc) == the_docs.end()) {
PyErr_SetString(PyExc_AttributeError, "doc");
return 0;
@ -505,7 +504,7 @@ Doc_getattro(recoll_DocObject *self, PyObject *nameobj)
if (PyUnicode_Check(nameobj)) {
utf8o = PyUnicode_AsUTF8String(nameobj);
if (utf8o == 0) {
LOGERR(("Doc_getattro: encoding name to utf8 failed\n"));
LOGERR("Doc_getattro: encoding name to utf8 failed\n" );
PyErr_SetString(PyExc_AttributeError, "name??");
Py_RETURN_NONE;
}
@ -597,7 +596,7 @@ Doc_getattro(recoll_DocObject *self, PyObject *nameobj)
}
if (found) {
LOGDEB1(("Doc_getattro: [%s] -> [%s]\n", key.c_str(), value.c_str()));
LOGDEB1("Doc_getattro: [" << (key) << "] -> [" << (value) << "]\n" );
// Return a python unicode object
return PyUnicode_Decode(value.c_str(), value.size(), "utf-8",
"replace");
@ -636,15 +635,14 @@ Doc_setattr(recoll_DocObject *self, char *name, PyObject *value)
PyObject* putf8 = PyUnicode_AsUTF8String(value);
if (putf8 == 0) {
LOGERR(("Doc_setmeta: encoding to utf8 failed\n"));
LOGERR("Doc_setmeta: encoding to utf8 failed\n" );
PyErr_SetString(PyExc_AttributeError, "value??");
return -1;
}
char* uvalue = PyBytes_AsString(putf8);
string key = rclconfig->fieldQCanon(string(name));
LOGDEB0(("Doc_setattr: doc %p [%s] (%s) -> [%s]\n",
self->doc, key.c_str(), name, uvalue));
LOGDEB0("Doc_setattr: doc " << (self->doc) << " [" << (key) << "] (" << (name) << ") -> [" << (uvalue) << "]\n" );
// We set the value in the meta array in all cases. Good idea ? or do it
// only for fields without a dedicated Doc:: entry?
@ -804,7 +802,7 @@ PyDoc_STRVAR(doc_Query_close,
static PyObject *
Query_close(recoll_QueryObject *self)
{
LOGDEB(("Query_close\n"));
LOGDEB("Query_close\n" );
if (self->query) {
the_queries.erase(self->query);
deleteZ(self->query);
@ -820,7 +818,7 @@ Query_close(recoll_QueryObject *self)
static void
Query_dealloc(recoll_QueryObject *self)
{
LOGDEB(("Query_dealloc\n"));
LOGDEB("Query_dealloc\n" );
PyObject *ret = Query_close(self);
Py_DECREF(ret);
Py_TYPE(self)->tp_free((PyObject*)self);
@ -829,7 +827,7 @@ Query_dealloc(recoll_QueryObject *self)
static PyObject *
Query_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
LOGDEB(("Query_new\n"));
LOGDEB("Query_new\n" );
recoll_QueryObject *self;
self = (recoll_QueryObject *)type->tp_alloc(type, 0);
@ -851,7 +849,7 @@ Query_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static int
Query_init(recoll_QueryObject *self, PyObject *, PyObject *)
{
LOGDEB(("Query_init\n"));
LOGDEB("Query_init\n" );
if (self->query)
the_queries.erase(self->query);
@ -879,7 +877,7 @@ PyDoc_STRVAR(doc_Query_sortby,
static PyObject *
Query_sortby(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Query_sortby\n"));
LOGDEB0("Query_sortby\n" );
static const char *kwlist[] = {"field", "ascending", NULL};
char *sfield = 0;
PyObject *ascobj = 0;
@ -913,7 +911,7 @@ PyDoc_STRVAR(doc_Query_execute,
static PyObject *
Query_execute(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Query_execute\n"));
LOGDEB0("Query_execute\n" );
static const char *kwlist[] = {"query_string", "stemming", "stemlang", NULL};
char *sutf8 = 0; // needs freeing
char *sstemlang = 0;
@ -936,8 +934,7 @@ Query_execute(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
PyMem_Free(sstemlang);
}
LOGDEB0(("Query_execute: [%s] dostem %d stemlang [%s]\n", utf8.c_str(),
dostem, stemlang.c_str()));
LOGDEB0("Query_execute: [" << (utf8) << "] dostem " << (dostem) << " stemlang [" << (stemlang) << "]\n" );
if (self->query == 0 ||
the_queries.find(self->query) == the_queries.end()) {
@ -974,7 +971,7 @@ PyDoc_STRVAR(doc_Query_executesd,
static PyObject *
Query_executesd(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Query_executeSD\n"));
LOGDEB0("Query_executeSD\n" );
static const char *kwlist[] = {"searchdata", NULL};
recoll_SearchDataObject *pysd = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:Query_execute",
@ -1016,7 +1013,7 @@ PyDoc_STRVAR(doc_Query_fetchone,
static PyObject *
Query_fetchone(PyObject *_self)
{
LOGDEB0(("Query_fetchone/next\n"));
LOGDEB0("Query_fetchone/next\n" );
recoll_QueryObject* self = (recoll_QueryObject*)_self;
if (self->query == 0 ||
@ -1057,7 +1054,7 @@ PyDoc_STRVAR(doc_Query_fetchmany,
static PyObject *
Query_fetchmany(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Query_fetchmany\n"));
LOGDEB0("Query_fetchmany\n" );
static const char *kwlist[] = {"size", NULL};
int size = 0;
@ -1107,7 +1104,7 @@ PyDoc_STRVAR(doc_Query_scroll,
static PyObject *
Query_scroll(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Query_scroll\n"));
LOGDEB0("Query_scroll\n" );
static const char *kwlist[] = {"position", "mode", NULL};
int pos = 0;
char *smode = 0;
@ -1194,7 +1191,7 @@ public:
static PyObject *
Query_highlight(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Query_highlight\n"));
LOGDEB0("Query_highlight\n" );
static const char *kwlist[] = {"text", "ishtml", "eolbr", "methods", NULL};
char *sutf8 = 0; // needs freeing
int ishtml = 0;
@ -1216,7 +1213,7 @@ Query_highlight(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
ishtml = 1;
if (eolbrobj && !PyObject_IsTrue(eolbrobj))
eolbr = 0;
LOGDEB0(("Query_highlight: ishtml %d\n", ishtml));
LOGDEB0("Query_highlight: ishtml " << (ishtml) << "\n" );
if (self->query == 0 ||
the_queries.find(self->query) == the_queries.end()) {
@ -1254,7 +1251,7 @@ PyDoc_STRVAR(doc_Query_makedocabstract,
static PyObject *
Query_makedocabstract(recoll_QueryObject* self, PyObject *args,PyObject *kwargs)
{
LOGDEB0(("Query_makeDocAbstract\n"));
LOGDEB0("Query_makeDocAbstract\n" );
static const char *kwlist[] = {"doc", "methods", NULL};
recoll_DocObject *pydoc = 0;
PyObject *hlmethods = 0;
@ -1266,12 +1263,12 @@ Query_makedocabstract(recoll_QueryObject* self, PyObject *args,PyObject *kwargs)
}
if (pydoc->doc == 0 || the_docs.find(pydoc->doc) == the_docs.end()) {
LOGERR(("Query_makeDocAbstract: doc not found %p\n", pydoc->doc));
LOGERR("Query_makeDocAbstract: doc not found " << (pydoc->doc) << "\n" );
PyErr_SetString(PyExc_AttributeError, "doc");
return 0;
}
if (the_queries.find(self->query) == the_queries.end()) {
LOGERR(("Query_makeDocAbstract: query not found %p\n", self->query));
LOGERR("Query_makeDocAbstract: query not found " << (self->query) << "\n" );
PyErr_SetString(PyExc_AttributeError, "query");
return 0;
}
@ -1324,7 +1321,7 @@ PyDoc_STRVAR(doc_Query_getxquery,
static PyObject *
Query_getxquery(recoll_QueryObject* self, PyObject *, PyObject *)
{
LOGDEB0(("Query_getxquery self->query %p\n", self->query));
LOGDEB0("Query_getxquery self->query " << (self->query) << "\n" );
if (self->query == 0 ||
the_queries.find(self->query) == the_queries.end()) {
@ -1352,7 +1349,7 @@ PyDoc_STRVAR(doc_Query_getgroups,
static PyObject *
Query_getgroups(recoll_QueryObject* self, PyObject *, PyObject *)
{
LOGDEB0(("Query_getgroups\n"));
LOGDEB0("Query_getgroups\n" );
if (self->query == 0 ||
the_queries.find(self->query) == the_queries.end()) {
@ -1497,7 +1494,7 @@ typedef struct recoll_DbObject {
static PyObject *
Db_close(recoll_DbObject *self)
{
LOGDEB(("Db_close. self %p\n", self));
LOGDEB("Db_close. self " << (self) << "\n" );
if (self->db) {
the_dbs.erase(self->db);
delete self->db;
@ -1509,7 +1506,7 @@ Db_close(recoll_DbObject *self)
static void
Db_dealloc(recoll_DbObject *self)
{
LOGDEB(("Db_dealloc\n"));
LOGDEB("Db_dealloc\n" );
PyObject *ret = Db_close(self);
Py_DECREF(ret);
Py_TYPE(self)->tp_free((PyObject*)self);
@ -1518,7 +1515,7 @@ Db_dealloc(recoll_DbObject *self)
static PyObject *
Db_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
LOGDEB2(("Db_new\n"));
LOGDEB2("Db_new\n" );
recoll_DbObject *self;
self = (recoll_DbObject *)type->tp_alloc(type, 0);
@ -1550,7 +1547,7 @@ Db_init(recoll_DbObject *self, PyObject *args, PyObject *kwargs)
} else {
rclconfig = recollinit(0, 0, reason, 0);
}
LOGDEB(("Db_init\n"));
LOGDEB("Db_init\n" );
if (rclconfig == 0) {
PyErr_SetString(PyExc_EnvironmentError, reason.c_str());
@ -1566,7 +1563,7 @@ Db_init(recoll_DbObject *self, PyObject *args, PyObject *kwargs)
delete self->db;
self->db = new Rcl::Db(rclconfig);
if (!self->db->open(writable ? Rcl::Db::DbUpd : Rcl::Db::DbRO)) {
LOGERR(("Db_init: db open error\n"));
LOGERR("Db_init: db open error\n" );
PyErr_SetString(PyExc_EnvironmentError, "Can't open index");
return -1;
}
@ -1609,9 +1606,9 @@ Db_init(recoll_DbObject *self, PyObject *args, PyObject *kwargs)
static PyObject *
Db_query(recoll_DbObject* self)
{
LOGDEB(("Db_query\n"));
LOGDEB("Db_query\n" );
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_query: db not found %p\n", self->db));
LOGERR("Db_query: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db");
return 0;
}
@ -1630,18 +1627,18 @@ Db_query(recoll_DbObject* self)
static PyObject *
Db_setAbstractParams(recoll_DbObject *self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Db_setAbstractParams\n"));
LOGDEB0("Db_setAbstractParams\n" );
static const char *kwlist[] = {"maxchars", "contextwords", NULL};
int ctxwords = -1, maxchars = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii", (char**)kwlist,
&maxchars, &ctxwords))
return 0;
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_query: db not found %p\n", self->db));
LOGERR("Db_query: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db id not found");
return 0;
}
LOGDEB0(("Db_setAbstractParams: mxchrs %d, ctxwrds %d\n", maxchars, ctxwords));
LOGDEB0("Db_setAbstractParams: mxchrs " << (maxchars) << ", ctxwrds " << (ctxwords) << "\n" );
self->db->setAbstractParams(-1, maxchars, ctxwords);
Py_RETURN_NONE;
}
@ -1649,7 +1646,7 @@ Db_setAbstractParams(recoll_DbObject *self, PyObject *args, PyObject *kwargs)
static PyObject *
Db_makeDocAbstract(recoll_DbObject* self, PyObject *args)
{
LOGDEB0(("Db_makeDocAbstract\n"));
LOGDEB0("Db_makeDocAbstract\n" );
recoll_DocObject *pydoc = 0;
recoll_QueryObject *pyquery = 0;
if (!PyArg_ParseTuple(args, "O!O!:Db_makeDocAbstract",
@ -1658,18 +1655,18 @@ Db_makeDocAbstract(recoll_DbObject* self, PyObject *args)
return 0;
}
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_makeDocAbstract: db not found %p\n", self->db));
LOGERR("Db_makeDocAbstract: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db");
return 0;
}
if (pydoc->doc == 0 || the_docs.find(pydoc->doc) == the_docs.end()) {
LOGERR(("Db_makeDocAbstract: doc not found %p\n", pydoc->doc));
LOGERR("Db_makeDocAbstract: doc not found " << (pydoc->doc) << "\n" );
PyErr_SetString(PyExc_AttributeError, "doc");
return 0;
}
if (pyquery->query == 0 ||
the_queries.find(pyquery->query) == the_queries.end()) {
LOGERR(("Db_makeDocAbstract: query not found %p\n", pyquery->query));
LOGERR("Db_makeDocAbstract: query not found " << (pyquery->query) << "\n" );
PyErr_SetString(PyExc_AttributeError, "query");
return 0;
}
@ -1694,7 +1691,7 @@ PyDoc_STRVAR(doc_Db_termMatch,
static PyObject *
Db_termMatch(recoll_DbObject* self, PyObject *args, PyObject *kwargs)
{
LOGDEB0(("Db_termMatch\n"));
LOGDEB0("Db_termMatch\n" );
static const char *kwlist[] = {"type", "expr", "field", "maxlen",
"casesens", "diacsens", "lang", NULL};
char *tp = 0;
@ -1717,7 +1714,7 @@ Db_termMatch(recoll_DbObject* self, PyObject *args, PyObject *kwargs)
return 0;
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_termMatch: db not found %p\n", self->db));
LOGERR("Db_termMatch: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db");
goto out;
}
@ -1742,7 +1739,7 @@ Db_termMatch(recoll_DbObject* self, PyObject *args, PyObject *kwargs)
if (!self->db->termMatch(typ_sens, lang ? lang : "english",
expr, result, maxlen, field ? field : "")) {
LOGERR(("Db_termMatch: db termMatch error\n"));
LOGERR("Db_termMatch: db termMatch error\n" );
PyErr_SetString(PyExc_AttributeError, "rcldb termMatch error");
goto out;
}
@ -1763,7 +1760,7 @@ out:
static PyObject *
Db_needUpdate(recoll_DbObject* self, PyObject *args, PyObject *kwds)
{
LOGDEB0(("Db_needUpdate\n"));
LOGDEB0("Db_needUpdate\n" );
char *udi = 0; // needs freeing
char *sig = 0; // needs freeing
if (!PyArg_ParseTuple(args, "eses:Db_needUpdate",
@ -1771,7 +1768,7 @@ Db_needUpdate(recoll_DbObject* self, PyObject *args, PyObject *kwds)
return 0;
}
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_needUpdate: db not found %p\n", self->db));
LOGERR("Db_needUpdate: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db");
PyMem_Free(udi);
PyMem_Free(sig);
@ -1786,13 +1783,13 @@ Db_needUpdate(recoll_DbObject* self, PyObject *args, PyObject *kwds)
static PyObject *
Db_delete(recoll_DbObject* self, PyObject *args, PyObject *kwds)
{
LOGDEB0(("Db_delete\n"));
LOGDEB0("Db_delete\n" );
char *udi = 0; // needs freeing
if (!PyArg_ParseTuple(args, "es:Db_delete", "utf-8", &udi)) {
return 0;
}
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_delete: db not found %p\n", self->db));
LOGERR("Db_delete: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db");
PyMem_Free(udi);
return 0;
@ -1805,9 +1802,9 @@ Db_delete(recoll_DbObject* self, PyObject *args, PyObject *kwds)
static PyObject *
Db_purge(recoll_DbObject* self)
{
LOGDEB0(("Db_purge\n"));
LOGDEB0("Db_purge\n" );
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_purge: db not found %p\n", self->db));
LOGERR("Db_purge: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db");
return 0;
}
@ -1818,7 +1815,7 @@ Db_purge(recoll_DbObject* self)
static PyObject *
Db_addOrUpdate(recoll_DbObject* self, PyObject *args, PyObject *)
{
LOGDEB0(("Db_addOrUpdate\n"));
LOGDEB0("Db_addOrUpdate\n" );
char *sudi = 0; // needs freeing
char *sparent_udi = 0; // needs freeing
recoll_DocObject *pydoc;
@ -1834,17 +1831,17 @@ Db_addOrUpdate(recoll_DbObject* self, PyObject *args, PyObject *)
PyMem_Free(sparent_udi);
if (self->db == 0 || the_dbs.find(self->db) == the_dbs.end()) {
LOGERR(("Db_addOrUpdate: db not found %p\n", self->db));
LOGERR("Db_addOrUpdate: db not found " << (self->db) << "\n" );
PyErr_SetString(PyExc_AttributeError, "db");
return 0;
}
if (pydoc->doc == 0 || the_docs.find(pydoc->doc) == the_docs.end()) {
LOGERR(("Db_addOrUpdate: doc not found %p\n", pydoc->doc));
LOGERR("Db_addOrUpdate: doc not found " << (pydoc->doc) << "\n" );
PyErr_SetString(PyExc_AttributeError, "doc");
return 0;
}
if (!self->db->addOrUpdate(udi, parent_udi, *pydoc->doc)) {
LOGERR(("Db_addOrUpdate: rcldb error\n"));
LOGERR("Db_addOrUpdate: rcldb error\n" );
PyErr_SetString(PyExc_AttributeError, "rcldb error");
return 0;
}
@ -1959,7 +1956,7 @@ static PyTypeObject recoll_DbType = {
static PyObject *
recoll_connect(PyObject *self, PyObject *args, PyObject *kwargs)
{
LOGDEB2(("recoll_connect\n"));
LOGDEB2("recoll_connect\n" );
recoll_DbObject *db = (recoll_DbObject *)
PyObject_Call((PyObject *)&recoll_DbType, args, kwargs);
return (PyObject *)db;
@ -2094,3 +2091,4 @@ initrecoll(void)
return module;
#endif
}

View file

@ -18,6 +18,7 @@ if "CYGWIN" in os.environ:
else:
libraries = ['recoll']
extra_compile_args = ['-std=c++11']
if 'libdir' in os.environ and os.environ['libdir'] != "":
runtime_library_dirs = [os.path.join(os.environ['libdir'], 'recoll')]
@ -39,6 +40,7 @@ module1 = Extension('recoll',
os.path.join(top, 'query'),
os.path.join(top, 'unac')
],
extra_compile_args = extra_compile_args,
libraries = libraries,
library_dirs = library_dirs,
runtime_library_dirs = runtime_library_dirs,
@ -57,6 +59,7 @@ module2 = Extension('rclextract',
os.path.join(top, 'internfile'),
os.path.join(top, 'rcldb'),
],
extra_compile_args = extra_compile_args,
libraries = libraries,
library_dirs = library_dirs,
runtime_library_dirs = runtime_library_dirs,

View file

@ -38,7 +38,7 @@ using namespace std;
#include "recoll.h"
#include "rclconfig.h"
#include "debuglog.h"
#include "log.h"
#include "searchdata.h"
#include "guiutils.h"
#include "rclhelp.h"
@ -443,7 +443,7 @@ void AdvSearch::runSearch()
entries.push_back(subtreeCMB->currentText());
entries.sort();
entries.unique();
LOGDEB(("Subtree list now has %d entries\n", entries.size()));
LOGDEB("Subtree list now has " << (entries.size()) << " entries\n" );
subtreeCMB->clear();
for (list<QString>::iterator it = entries.begin();
it != entries.end(); it++) {
@ -479,7 +479,7 @@ void AdvSearch::fromSearch(STD_SHARED_PTR<SearchData> sdata)
for (unsigned int i = 0; i < sdata->m_query.size(); i++) {
// Set fields from clause
if (sdata->m_query[i]->getTp() == SCLT_SUB) {
LOGERR(("AdvSearch::fromSearch: SUB clause found !\n"));
LOGERR("AdvSearch::fromSearch: SUB clause found !\n" );
continue;
}
if (sdata->m_query[i]->getTp() == SCLT_PATH) {
@ -576,3 +576,4 @@ void AdvSearch::slotHistoryPrev()
fromSearch(sd);
}

View file

@ -19,7 +19,7 @@
#include "advshist.h"
#include "guiutils.h"
#include "debuglog.h"
#include "log.h"
#include "xmltosd.h"
using namespace std;
@ -94,3 +94,4 @@ void AdvSearchHist::clear()
{
g_dynconf->eraseAll(advSearchHistSk);
}

View file

@ -40,7 +40,7 @@
#include "confgui.h"
#include "smallut.h"
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "guiutils.h"
@ -376,7 +376,7 @@ void ConfParamSLW::showInputDialog()
void ConfParamSLW::listToConf()
{
list<string> ls;
LOGDEB2(("ConfParamSLW::listToConf. m_fsencoding %d\n", int(m_fsencoding)));
LOGDEB2("ConfParamSLW::listToConf. m_fsencoding " << (int(m_fsencoding)) << "\n" );
for (int i = 0; i < m_lb->count(); i++) {
// General parameters are encoded as utf-8. File names as
// local8bit There is no hope for 8bit file names anyway
@ -423,7 +423,7 @@ void ConfParamSLW::deleteSelected()
}
for (vector<int>::reverse_iterator it = idxes.rbegin();
it != idxes.rend(); it++) {
LOGDEB0(("deleteSelected: %d was selected\n", *it));
LOGDEB0("deleteSelected: " << (*it) << " was selected\n" );
QListWidgetItem *item = m_lb->takeItem(*it);
emit entryDeleted(item->text());
delete item;
@ -476,3 +476,4 @@ void ConfParamCSLW::showInputDialog()
}
} // Namespace confgui

View file

@ -35,7 +35,7 @@ using std::list;
#include "recoll.h"
#include "confguiindex.h"
#include "smallut.h"
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "conflinkrcl.h"
#include "execmd.h"
@ -68,9 +68,9 @@ ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
void ConfIndexW::acceptChanges()
{
LOGDEB(("ConfIndexW::acceptChanges()\n"));
LOGDEB("ConfIndexW::acceptChanges()\n" );
if (!m_conf) {
LOGERR(("ConfIndexW::acceptChanges: no config\n"));
LOGERR("ConfIndexW::acceptChanges: no config\n" );
return;
}
// Let the changes to disk
@ -88,7 +88,7 @@ void ConfIndexW::acceptChanges()
void ConfIndexW::rejectChanges()
{
LOGDEB(("ConfIndexW::rejectChanges()\n"));
LOGDEB("ConfIndexW::rejectChanges()\n" );
// Discard local changes.
delete m_conf;
m_conf = 0;
@ -477,7 +477,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config,
string cmd = "iconv";
int status = ex.doexec(cmd, args, 0, &icout);
if (status) {
LOGERR(("Can't get list of charsets from 'iconv -l'"));
LOGERR("Can't get list of charsets from 'iconv -l'" );
}
icout = neutchars(icout, ",");
list<string> ccsets;
@ -579,7 +579,7 @@ void ConfSubPanelW::reloadAll()
void ConfSubPanelW::subDirChanged(QListWidgetItem *current, QListWidgetItem *)
{
LOGDEB(("ConfSubPanelW::subDirChanged\n"));
LOGDEB("ConfSubPanelW::subDirChanged\n" );
if (current == 0 || current->text() == "") {
m_sk = "";
@ -588,13 +588,13 @@ void ConfSubPanelW::subDirChanged(QListWidgetItem *current, QListWidgetItem *)
m_sk = (const char *) current->text().toUtf8();
m_groupbox->setTitle(current->text());
}
LOGDEB(("ConfSubPanelW::subDirChanged: now [%s]\n", m_sk.c_str()));
LOGDEB("ConfSubPanelW::subDirChanged: now [" << (m_sk) << "]\n" );
reloadAll();
}
void ConfSubPanelW::subDirDeleted(QString sbd)
{
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.toUtf8()));
LOGDEB("ConfSubPanelW::subDirDeleted(" << ((const char *)sbd.toUtf8()) << ")\n" );
if (sbd == "") {
// Can't do this, have to reinsert it
QTimer::singleShot(0, this, SLOT(restoreEmpty()));
@ -606,8 +606,9 @@ void ConfSubPanelW::subDirDeleted(QString sbd)
void ConfSubPanelW::restoreEmpty()
{
LOGDEB(("ConfSubPanelW::restoreEmpty()\n"));
LOGDEB("ConfSubPanelW::restoreEmpty()\n" );
m_subdirs->getListBox()->insertItem(0, "");
}
} // Namespace confgui

View file

@ -25,7 +25,7 @@
*/
#include "confgui.h"
#include "conftree.h"
#include "debuglog.h"
#include "log.h"
namespace confgui {
@ -42,10 +42,10 @@ public:
{
if (!m_conf)
return false;
LOGDEB1(("Setting [%s] value to [%s]\n", m_nm.c_str(), val.c_str()));
LOGDEB1("Setting [" << (m_nm) << "] value to [" << (val) << "]\n" );
bool ret = m_conf->set(m_nm, val, m_sk?*m_sk:"");
if (!ret)
LOGERR(("Value set failed\n"));
LOGERR("Value set failed\n" );
return ret;
}
virtual bool get(string& val)
@ -53,9 +53,7 @@ public:
if (!m_conf)
return false;
bool ret = m_conf->get(m_nm, val, m_sk?*m_sk:"");
LOGDEB1(("ConfLinkRcl::get: [%s] sk [%s] -> [%s]\n",
m_nm.c_str(), m_sk?m_sk->c_str():"",
ret ? val.c_str() : "no value"));
LOGDEB1("ConfLinkRcl::get: [" << (m_nm) << "] sk [" << (m_sk?m_sk:"") << "] -> [" << (ret ? val : "no value") << "]\n" );
return ret;
}
private:
@ -67,3 +65,4 @@ private:
} // Namespace confgui
#endif /* _CONFLINKRCL_H_INCLUDED_ */

View file

@ -39,7 +39,7 @@ using namespace std;
#include "pathut.h"
#include "confguiindex.h"
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "execmd.h"
#include "conflinkrcl.h"
@ -89,9 +89,6 @@ int main(int argc, char **argv)
argc--; argv++;
}
DebugLog::getdbl()->setloglevel(DEBDEB1);
DebugLog::setfilename("stderr");
string a_config = "tstconfdir";
config = new RclConfig(&a_config);
if (config == 0 || !config->ok()) {
@ -130,3 +127,4 @@ int main(int argc, char **argv)
// Let's go
return app.exec();
}

View file

@ -34,7 +34,7 @@
#include "pathut.h"
#include "smallut.h"
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "readfile.h"
#include "copyfile.h"
@ -158,7 +158,7 @@ FragButs::FragButs(QWidget* parent)
QMessageBox::warning(0, "Recoll",
tr("%1 not found.").arg(
QString::fromLocal8Bit(m_fn.c_str())));
LOGERR(("Fragbuts:: can't read [%s]\n", m_fn.c_str()));
LOGERR("Fragbuts:: can't read [" << (m_fn) << "]\n" );
return;
}
FragButsParser parser(this, m_buttons);
@ -199,7 +199,7 @@ bool FragButs::isStale(time_t *reftime)
void FragButs::onButtonClicked(bool on)
{
LOGDEB(("FragButs::onButtonClicked: [%d]\n", int(on)));
LOGDEB("FragButs::onButtonClicked: [" << (int(on)) << "]\n" );
emit fragmentsChanged();
}
@ -208,8 +208,9 @@ void FragButs::getfrags(std::vector<std::string>& frags)
for (vector<ButFrag>::iterator it = m_buttons.begin();
it != m_buttons.end(); it++) {
if (it->button->isChecked() && !it->fragment.empty()) {
LOGDEB(("FragButs: fragment [%s]\n", it->fragment.c_str()));
LOGDEB("FragButs: fragment [" << (it->fragment) << "]\n" );
frags.push_back(it->fragment);
}
}
}

View file

@ -20,7 +20,7 @@
#include <cstdio>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "guiutils.h"
#include "pathut.h"
@ -73,7 +73,7 @@ static bool havereadsettings;
void rwSettings(bool writing)
{
LOGDEB1(("rwSettings: write %d\n", int(writing)));
LOGDEB1("rwSettings: write " << (int(writing)) << "\n" );
if (writing && !havereadsettings)
return;
QSettings settings("Recoll.org", "recoll");
@ -312,12 +312,11 @@ void rwSettings(bool writing)
continue;
bool stripped;
if (!Rcl::Db::testDbDir(dbdir, &stripped)) {
LOGERR(("Not a xapian index: [%s]\n", dbdir.c_str()));
LOGERR("Not a xapian index: [" << (dbdir) << "]\n" );
continue;
}
if (stripped != o_index_stripchars) {
LOGERR(("Incompatible character stripping: [%s]\n",
dbdir.c_str()));
LOGERR("Incompatible character stripping: [" << (dbdir) << "]\n" );
continue;
}
prefs.allExtraDbs.push_back(dbdir);
@ -334,8 +333,7 @@ void rwSettings(bool writing)
bool stripped;
if (!Rcl::Db::testDbDir(*it, &stripped) ||
stripped != o_index_stripchars) {
LOGINFO(("Not a Xapian index or char stripping differs: [%s]\n",
it->c_str()));
LOGINFO("Not a Xapian index or char stripping differs: [" << *it << "]\n" );
it = prefs.activeExtraDbs.erase(it);
} else {
it++;
@ -359,8 +357,7 @@ void rwSettings(bool writing)
bool strpd;
if (!Rcl::Db::testDbDir(dbdir, &strpd) ||
strpd != o_index_stripchars) {
LOGERR(("Not a Xapian dir or diff. char stripping: [%s]\n",
dbdir.c_str()));
LOGERR("Not a Xapian dir or diff. char stripping: [" << (dbdir) << "]\n" );
continue;
}
prefs.activeExtraDbs.push_back(dbdir);
@ -414,3 +411,4 @@ string PrefsPack::stemlang()
}
return stemLang;
}

View file

@ -36,7 +36,7 @@
#include "recoll.h"
#include "smallut.h"
#include "rclinit.h"
#include "debuglog.h"
#include "log.h"
#include "rclmain_w.h"
#include "ssearch_w.h"
#include "guiutils.h"
@ -98,7 +98,7 @@ void startManual(const string& helpindex)
bool maybeOpenDb(string &reason, bool force, bool *maindberror)
{
LOGDEB2(("maybeOpenDb: force %d\n", force));
LOGDEB2("maybeOpenDb: force " << (force) << "\n" );
if (!rcldb) {
reason = "Internal error: db not created";
return false;
@ -109,7 +109,7 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror)
rcldb->rmQueryDb("");
for (list<string>::const_iterator it = prefs.activeExtraDbs.begin();
it != prefs.activeExtraDbs.end(); it++) {
LOGDEB(("main: adding [%s]\n", it->c_str()));
LOGDEB("main: adding [" << *it << "]\n" );
rcldb->addQueryDb(*it);
}
Rcl::Db::OpenError error;
@ -136,8 +136,7 @@ bool getStemLangs(vector<string>& vlangs)
string reason;
if (maybeOpenDb(reason)) {
vlangs = rcldb->getStemLangs();
LOGDEB0(("getStemLangs: from index: %s\n",
stringsToString(vlangs).c_str()));
LOGDEB0("getStemLangs: from index: " << (stringsToString(vlangs)) << "\n" );
return true;
} else {
// Cant get the langs from the index. Maybe it just does not
@ -153,7 +152,7 @@ bool getStemLangs(vector<string>& vlangs)
static void recollCleanup()
{
LOGDEB2(("recollCleanup: closing database\n"));
LOGDEB2("recollCleanup: closing database\n" );
deleteZ(rcldb);
deleteZ(theconfig);
@ -163,13 +162,13 @@ static void recollCleanup()
deleteZ(aspell);
#endif
LOGDEB2(("recollCleanup: done\n"));
LOGDEB2("recollCleanup: done\n" );
}
void applyStyleSheet(const QString& ssfname)
{
const char *cfname = (const char *)ssfname.toLocal8Bit();
LOGDEB0(("Applying style sheet: [%s]\n", cfname));
LOGDEB0("Applying style sheet: [" << (cfname) << "]\n" );
if (cfname && *cfname) {
string stylesheet;
file_to_string(cfname, stylesheet);
@ -327,7 +326,7 @@ int main(int argc, char **argv)
aspell = new Aspell(theconfig);
aspell->init(reason);
if (!aspell || !aspell->ok()) {
LOGDEB(("Aspell speller creation failed %s\n", reason.c_str()));
LOGDEB("Aspell speller creation failed " << (reason) << "\n" );
aspell = 0;
}
#endif
@ -396,7 +395,7 @@ int main(int argc, char **argv)
mainWindow->
sSearch->setSearchString(QString::fromLocal8Bit(question.c_str()));
} else if (!urltoview.empty()) {
LOGDEB(("MAIN: got urltoview [%s]\n", urltoview.c_str()));
LOGDEB("MAIN: got urltoview [" << (urltoview) << "]\n" );
mainWindow->setUrlToView(QString::fromLocal8Bit(urltoview.c_str()));
}
return app.exec();
@ -404,7 +403,7 @@ int main(int argc, char **argv)
QString myGetFileName(bool isdir, QString caption, bool filenosave)
{
LOGDEB1(("myFileDialog: isdir %d\n", isdir));
LOGDEB1("myFileDialog: isdir " << (isdir) << "\n" );
QFileDialog dialog(0, caption);
if (isdir) {
@ -430,3 +429,4 @@ QString myGetFileName(bool isdir, QString caption, bool filenosave)
}
return QString();
}

View file

@ -30,7 +30,7 @@ using namespace std;
#include "recoll.h"
#include "multisave.h"
#include "smallut.h"
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include "internfile.h"
@ -52,7 +52,7 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
return;
}
string dir((const char *)dirl[0].toLocal8Bit());
LOGDEB2(("multiSave: got dir %s\n", dir.c_str()));
LOGDEB2("multiSave: got dir " << (dir) << "\n" );
/* Save doc to files in target directory. Issues:
- It is quite common to have docs in the array with the save
@ -90,13 +90,13 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
string utf8fn;
it->getmeta(Rcl::Doc::keyfn, &utf8fn);
string suffix = path_suffix(utf8fn);
LOGDEB(("Multisave: [%s] suff [%s]\n", utf8fn.c_str(), suffix.c_str()));
LOGDEB("Multisave: [" << (utf8fn) << "] suff [" << (suffix) << "]\n" );
if (suffix.empty() || suffix.size() > 10) {
suffix = theconfig->getSuffixFromMimeType(it->mimetype);
LOGDEB(("Multisave: suff from config [%s]\n", suffix.c_str()));
LOGDEB("Multisave: suff from config [" << (suffix) << "]\n" );
}
string simple = path_basename(utf8fn, string(".") + suffix);
LOGDEB(("Multisave: simple [%s]\n", simple.c_str()));
LOGDEB("Multisave: simple [" << (simple) << "]\n" );
if (simple.empty())
simple = "rclsave";
if (simple.size() > maxlen) {
@ -141,3 +141,4 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
}
}
}

View file

@ -16,7 +16,7 @@
*/
#include <string>
#include "debuglog.h"
#include "log.h"
#include "preview_load.h"
#include "internfile.h"
#include "rcldoc.h"
@ -29,14 +29,10 @@ LoadThread::LoadThread(RclConfig *config, const Rcl::Doc& idc,
: QThread(parent), status(1), m_idoc(idc), m_previewHtml(pvhtm),
m_config(*config)
{
// Save log level while we're running in the calling thread.
m_loglevel = DebugLog::getdbl()->getlevel();
}
void LoadThread::run()
{
DebugLog::getdbl()->setloglevel(m_loglevel);
FileInterner interner(m_idoc, &m_config, FileInterner::FIF_forPreview);
FIMissingStore mst;
interner.setMissingStore(&mst);
@ -69,7 +65,8 @@ void LoadThread::run()
status = -1;
}
} catch (CancelExcept) {
LOGDEB(("LoadThread: cancelled\n"));
LOGDEB("LoadThread: cancelled\n" );
status = -1;
}
}

View file

@ -51,7 +51,6 @@ public:
private:
Rcl::Doc m_idoc;
int m_loglevel;
bool m_previewHtml;
RclConfig m_config;
};

View file

@ -26,7 +26,7 @@
#include "preview_plaintorich.h"
#include "plaintorich.h"
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "cancelcheck.h"
@ -71,9 +71,9 @@ string PlainToRichQtPreview::PlainToRichQtPreview::header()
string PlainToRichQtPreview::startMatch(unsigned int grpidx)
{
LOGDEB2(("startMatch, grpidx %u\n", grpidx));
LOGDEB2("startMatch, grpidx " << (grpidx) << "\n" );
grpidx = m_hdata->grpsugidx[grpidx];
LOGDEB2(("startMatch, ugrpidx %u\n", grpidx));
LOGDEB2("startMatch, ugrpidx " << (grpidx) << "\n" );
m_groupanchors[grpidx].push_back(++m_lastanchor);
m_groupcuranchors[grpidx] = 0;
return string("<span style='color: ").
@ -105,7 +105,7 @@ string PlainToRichQtPreview::startChunk()
int PlainToRichQtPreview::nextAnchorNum(int grpidx)
{
LOGDEB2(("nextAnchorNum: group %d\n", grpidx));
LOGDEB2("nextAnchorNum: group " << (grpidx) << "\n" );
map<unsigned int, unsigned int>::iterator curit =
m_groupcuranchors.find(grpidx);
map<unsigned int, vector<int> >::iterator vecit =
@ -122,7 +122,7 @@ int PlainToRichQtPreview::nextAnchorNum(int grpidx)
else
m_groupcuranchors[grpidx]++;
m_curanchor = vecit->second[m_groupcuranchors[grpidx]];
LOGDEB2(("nextAnchorNum: curanchor now %d\n", m_curanchor));
LOGDEB2("nextAnchorNum: curanchor now " << (m_curanchor) << "\n" );
}
return m_curanchor;
}
@ -161,7 +161,6 @@ ToRichThread::ToRichThread(const string &i, const HighlightData& hd,
QObject *parent)
: QThread(parent), m_input(i), m_hdata(hd), m_ptr(ptr), m_output(qrichlist)
{
m_loglevel = DebugLog::getdbl()->getlevel();
}
// Insert into editor by chunks so that the top becomes visible
@ -171,7 +170,6 @@ ToRichThread::ToRichThread(const string &i, const HighlightData& hd,
void ToRichThread::run()
{
DebugLog::getdbl()->setloglevel(m_loglevel);
list<string> out;
try {
m_ptr->plaintorich(m_input, out, m_hdata, CHUNKL);
@ -185,3 +183,4 @@ void ToRichThread::run()
m_output.push_back(QString::fromUtf8(it->c_str(), it->length()));
}
}

View file

@ -64,7 +64,6 @@ public:
virtual void run();
private:
int m_loglevel;
const string &m_input;
const HighlightData &m_hdata;
STD_SHARED_PTR<PlainToRichQtPreview> m_ptr;

View file

@ -45,7 +45,7 @@
#include <QShortcut>
#include <QTimer>
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include "internfile.h"
#include "recoll.h"
@ -195,7 +195,7 @@ void Preview::emitShowPrev()
void Preview::closeEvent(QCloseEvent *e)
{
LOGDEB(("Preview::closeEvent. m_loading %d\n", m_loading));
LOGDEB("Preview::closeEvent. m_loading " << (m_loading) << "\n" );
if (m_loading) {
CancelCheck::instance().setCancel();
e->ignore();
@ -226,11 +226,10 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
{
if (event->type() != QEvent::KeyPress) {
#if 0
LOGDEB(("Preview::eventFilter(): %s\n", eventTypeToStr(event->type())));
LOGDEB("Preview::eventFilter(): " << (eventTypeToStr(event->type())) << "\n" );
if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *mev = (QMouseEvent *)event;
LOGDEB(("Mouse: GlobalY %d y %d\n", mev->globalY(),
mev->y()));
LOGDEB("Mouse: GlobalY " << (mev->globalY()) << " y " << (mev->y()) << "\n" );
}
#endif
return false;
@ -241,7 +240,7 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
if (m_dynSearchActive) {
if (keyEvent->key() == Qt::Key_F3) {
LOGDEB2(("Preview::eventFilter: got F3\n"));
LOGDEB2("Preview::eventFilter: got F3\n" );
doSearch(searchTextCMB->currentText(), true,
(keyEvent->modifiers() & Qt::ShiftModifier) != 0);
return true;
@ -254,18 +253,18 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
if (keyEvent->key() == Qt::Key_Slash ||
(keyEvent->key() == Qt::Key_F &&
(keyEvent->modifiers() & Qt::ControlModifier))) {
LOGDEB2(("Preview::eventFilter: got / or C-F\n"));
LOGDEB2("Preview::eventFilter: got / or C-F\n" );
searchTextCMB->setFocus();
m_dynSearchActive = true;
return true;
} else if (keyEvent->key() == Qt::Key_Space) {
LOGDEB2(("Preview::eventFilter: got Space\n"));
LOGDEB2("Preview::eventFilter: got Space\n" );
int value = edit->verticalScrollBar()->value();
value += edit->verticalScrollBar()->pageStep();
edit->verticalScrollBar()->setValue(value);
return true;
} else if (keyEvent->key() == Qt::Key_Backspace) {
LOGDEB2(("Preview::eventFilter: got Backspace\n"));
LOGDEB2("Preview::eventFilter: got Backspace\n" );
int value = edit->verticalScrollBar()->value();
value -= edit->verticalScrollBar()->pageStep();
edit->verticalScrollBar()->setValue(value);
@ -279,8 +278,7 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
void Preview::searchTextChanged(const QString & text)
{
LOGDEB1(("Search line text changed. text: '%s'\n",
(const char *)text.toUtf8()));
LOGDEB1("Search line text changed. text: '" << ((const char *)text.toUtf8()) << "'\n" );
m_searchTextFromIndex = -1;
if (text.isEmpty()) {
m_dynSearchActive = false;
@ -294,13 +292,13 @@ void Preview::searchTextChanged(const QString & text)
void Preview::searchTextFromIndex(int idx)
{
LOGDEB1(("search line from index %d\n", idx));
LOGDEB1("search line from index " << (idx) << "\n" );
m_searchTextFromIndex = idx;
}
PreviewTextEdit *Preview::currentEditor()
{
LOGDEB2(("Preview::currentEditor()\n"));
LOGDEB2("Preview::currentEditor()\n" );
QWidget *tw = pvTab->currentWidget();
PreviewTextEdit *edit = 0;
if (tw) {
@ -325,9 +323,7 @@ void Preview::emitSaveDocToFile()
void Preview::doSearch(const QString &_text, bool next, bool reverse,
bool wordOnly)
{
LOGDEB(("Preview::doSearch: text [%s] idx %d next %d rev %d word %d\n",
(const char *)_text.toUtf8(), m_searchTextFromIndex, int(next),
int(reverse), int(wordOnly)));
LOGDEB("Preview::doSearch: text [" << ((const char *)_text.toUtf8()) << "] idx " << (m_searchTextFromIndex) << " next " << (int(next)) << " rev " << (int(reverse)) << " word " << (int(wordOnly)) << "\n" );
QString text = _text;
bool matchCase = matchCheck->isChecked();
@ -339,7 +335,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
if (text.isEmpty() || m_searchTextFromIndex != -1) {
if (!edit->m_plaintorich->haveAnchors()) {
LOGDEB(("NO ANCHORS\n"));
LOGDEB("NO ANCHORS\n" );
return;
}
// The combobox indices are equal to the search ugroup indices
@ -350,7 +346,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
edit->m_plaintorich->nextAnchorNum(m_searchTextFromIndex);
}
QString aname = edit->m_plaintorich->curAnchorName();
LOGDEB(("Calling scrollToAnchor(%s)\n", (const char *)aname.toUtf8()));
LOGDEB("Calling scrollToAnchor(" << ((const char *)aname.toUtf8()) << ")\n" );
edit->scrollToAnchor(aname);
// Position the cursor approximately at the anchor (top of
// viewport) so that searches start from here
@ -370,7 +366,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
edit->setTextCursor(cursor);
}
Chrono chron;
LOGDEB(("Preview::doSearch: first find call\n"));
LOGDEB("Preview::doSearch: first find call\n" );
QTextDocument::FindFlags flags = 0;
if (reverse)
flags |= QTextDocument::FindBackward;
@ -379,21 +375,19 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
if (matchCase)
flags |= QTextDocument::FindCaseSensitively;
bool found = edit->find(text, flags);
LOGDEB(("Preview::doSearch: first find call return: found %d %.2f S\n",
found, chron.secs()));
LOGDEB("Preview::doSearch: first find call return: found " << (found) << " " << (chron.secs()) << " S\n" );
// If not found, try to wrap around.
if (!found) {
LOGDEB(("Preview::doSearch: wrapping around\n"));
LOGDEB("Preview::doSearch: wrapping around\n" );
if (reverse) {
edit->moveCursor (QTextCursor::End);
} else {
edit->moveCursor (QTextCursor::Start);
}
LOGDEB(("Preview::doSearch: 2nd find call\n"));
LOGDEB("Preview::doSearch: 2nd find call\n" );
chron.restart();
found = edit->find(text, flags);
LOGDEB(("Preview::doSearch: 2nd find call return found %d %.2f S\n",
found, chron.secs()));
LOGDEB("Preview::doSearch: 2nd find call return found " << (found) << " " << (chron.secs()) << " S\n" );
}
if (found) {
@ -403,37 +397,37 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
QApplication::beep();
m_canBeep = false;
}
LOGDEB(("Preview::doSearch: return\n"));
LOGDEB("Preview::doSearch: return\n" );
}
void Preview::nextPressed()
{
LOGDEB2(("Preview::nextPressed\n"));
LOGDEB2("Preview::nextPressed\n" );
doSearch(searchTextCMB->currentText(), true, false);
}
void Preview::prevPressed()
{
LOGDEB2(("Preview::prevPressed\n"));
LOGDEB2("Preview::prevPressed\n" );
doSearch(searchTextCMB->currentText(), true, true);
}
// Called when user clicks on tab
void Preview::currentChanged(int index)
{
LOGDEB2(("PreviewTextEdit::currentChanged\n"));
LOGDEB2("PreviewTextEdit::currentChanged\n" );
QWidget *tw = pvTab->widget(index);
PreviewTextEdit *edit =
tw->findChild<PreviewTextEdit*>("pvEdit");
LOGDEB1(("Preview::currentChanged(). Editor: %p\n", edit));
LOGDEB1("Preview::currentChanged(). Editor: " << (edit) << "\n" );
if (edit == 0) {
LOGERR(("Editor child not found\n"));
LOGERR("Editor child not found\n" );
return;
}
edit->setFocus();
// Disconnect the print signal and reconnect it to the current editor
LOGDEB(("Disconnecting reconnecting print signal\n"));
LOGDEB("Disconnecting reconnecting print signal\n" );
disconnect(this, SIGNAL(printCurrentPreviewRequest()), 0, 0);
connect(this, SIGNAL(printCurrentPreviewRequest()), edit, SLOT(print()));
edit->installEventFilter(this);
@ -444,7 +438,7 @@ void Preview::currentChanged(int index)
void Preview::closeCurrentTab()
{
LOGDEB1(("Preview::closeCurrentTab: m_loading %d\n", m_loading));
LOGDEB1("Preview::closeCurrentTab: m_loading " << (m_loading) << "\n" );
if (m_loading) {
CancelCheck::instance().setCancel();
return;
@ -461,7 +455,7 @@ void Preview::closeCurrentTab()
PreviewTextEdit *Preview::addEditorTab()
{
LOGDEB1(("PreviewTextEdit::addEditorTab()\n"));
LOGDEB1("PreviewTextEdit::addEditorTab()\n" );
QWidget *anon = new QWidget((QWidget *)pvTab);
QVBoxLayout *anonLayout = new QVBoxLayout(anon);
PreviewTextEdit *editor = new PreviewTextEdit(anon, "pvEdit", this);
@ -475,7 +469,7 @@ PreviewTextEdit *Preview::addEditorTab()
void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
{
LOGDEB1(("Preview::setCurTabProps\n"));
LOGDEB1("Preview::setCurTabProps\n" );
QString title;
string ctitle;
if (doc.getmeta(Rcl::Doc::keytt, &ctitle) && !ctitle.empty()) {
@ -497,7 +491,7 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, "%Y-%m-%d %H:%M:%S", tm);
}
LOGDEB(("Doc.url: [%s]\n", doc.url.c_str()));
LOGDEB("Doc.url: [" << (doc.url) << "]\n" );
string url;
printableUrl(theconfig->getDefCharset(), doc.url, url);
string tiptxt = url + string("\n");
@ -517,10 +511,10 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
bool Preview::makeDocCurrent(const Rcl::Doc& doc, int docnum, bool sametab)
{
LOGDEB(("Preview::makeDocCurrent: %s\n", doc.url.c_str()));
LOGDEB("Preview::makeDocCurrent: " << (doc.url) << "\n" );
if (m_loading) {
LOGERR(("Already loading\n"));
LOGERR("Already loading\n" );
return false;
}
@ -609,7 +603,7 @@ public:
bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
{
LOGDEB1(("Preview::loadDocInCurrentTab()\n"));
LOGDEB1("Preview::loadDocInCurrentTab()\n" );
LoadGuard guard(&m_loading);
CancelCheck::instance().setCancel(false);
@ -647,10 +641,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
progress.show();
}
LOGDEB(("loadDocInCurrentTab: after file load: cancel %d status %d"
" text length %d\n",
CancelCheck::instance().cancelState(), lthr.status,
lthr.fdoc.text.length()));
LOGDEB("loadDocInCurrentTab: after file load: cancel " << (CancelCheck::instance().cancelState()) << " status " << (lthr.status) << " text length " << (lthr.fdoc.text.length()) << "\n" );
if (CancelCheck::instance().cancelState())
return false;
@ -719,10 +710,10 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
qApp->processEvents();
if (inputishtml) {
LOGDEB1(("Preview: got html %s\n", lthr.fdoc.text.c_str()));
LOGDEB1("Preview: got html " << (lthr.fdoc.text) << "\n" );
editor->m_plaintorich->set_inputhtml(true);
} else {
LOGDEB1(("Preview: got plain %s\n", lthr.fdoc.text.c_str()));
LOGDEB1("Preview: got plain " << (lthr.fdoc.text) << "\n" );
editor->m_plaintorich->set_inputhtml(false);
}
@ -753,8 +744,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
}
}
} else {
LOGDEB(("Preview: no hilighting, loading %d bytes\n",
int(lthr.fdoc.text.size())));
LOGDEB("Preview: no hilighting, loading " << (int(lthr.fdoc.text.size())) << " bytes\n" );
// No plaintorich() call. In this case, either the text is
// html and the html quoting is hopefully correct, or it's
// plain-text and there is no need to escape special
@ -804,7 +794,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
if (progress.wasCanceled()) {
editor->append("<b>Cancelled !</b>");
LOGDEB(("loadDocInCurrentTab: cancelled in editor load\n"));
LOGDEB("loadDocInCurrentTab: cancelled in editor load\n" );
break;
}
}
@ -836,7 +826,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
if (fn.empty() || !idoc.ipath.empty()) {
TempFile temp = lthr.tmpimg;
if (temp) {
LOGDEB1(("Preview: load: got temp file from internfile\n"));
LOGDEB1("Preview: load: got temp file from internfile\n" );
} else if (!FileInterner::idocToFile(temp, string(),
theconfig, idoc)) {
temp.reset(); // just in case.
@ -868,7 +858,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
// Position to the first query term
if (editor->m_plaintorich->haveAnchors()) {
QString aname = editor->m_plaintorich->curAnchorName();
LOGDEB2(("Call movetoanchor(%s)\n", (const char *)aname.toUtf8()));
LOGDEB2("Call movetoanchor(" << ((const char *)aname.toUtf8()) << ")\n" );
editor->scrollToAnchor(aname);
// Position the cursor approximately at the anchor (top of
// viewport) so that searches start from here
@ -886,7 +876,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
editor->setFocus();
emit(previewExposed(this, m_searchId, docnum));
LOGDEB(("loadDocInCurrentTab: returning true\n"));
LOGDEB("loadDocInCurrentTab: returning true\n" );
return true;
}
@ -905,7 +895,7 @@ PreviewTextEdit::PreviewTextEdit(QWidget* parent, const char* nm, Preview *pv)
void PreviewTextEdit::createPopupMenu(const QPoint& pos)
{
LOGDEB1(("PreviewTextEdit::createPopupMenu()\n"));
LOGDEB1("PreviewTextEdit::createPopupMenu()\n" );
QMenu *popup = new QMenu(this);
switch (m_curdsp) {
case PTE_DSPTXT:
@ -944,7 +934,7 @@ void PreviewTextEdit::createPopupMenu(const QPoint& pos)
// Display main text
void PreviewTextEdit::displayText()
{
LOGDEB1(("PreviewTextEdit::displayText()\n"));
LOGDEB1("PreviewTextEdit::displayText()\n" );
if (m_format == Qt::PlainText)
setPlainText(m_richtxt);
else
@ -955,7 +945,7 @@ void PreviewTextEdit::displayText()
// Display field values
void PreviewTextEdit::displayFields()
{
LOGDEB1(("PreviewTextEdit::displayFields()\n"));
LOGDEB1("PreviewTextEdit::displayFields()\n" );
QString txt = "<html><head></head><body>\n";
txt += "<b>" + QString::fromLocal8Bit(m_url.c_str());
@ -977,7 +967,7 @@ void PreviewTextEdit::displayFields()
void PreviewTextEdit::displayImage()
{
LOGDEB1(("PreviewTextEdit::displayImage()\n"));
LOGDEB1("PreviewTextEdit::displayImage()\n" );
if (m_image.isNull())
displayText();
@ -995,7 +985,7 @@ void PreviewTextEdit::displayImage()
void PreviewTextEdit::mouseDoubleClickEvent(QMouseEvent *event)
{
LOGDEB2(("PreviewTextEdit::mouseDoubleClickEvent\n"));
LOGDEB2("PreviewTextEdit::mouseDoubleClickEvent\n" );
QTextEdit::mouseDoubleClickEvent(event);
if (textCursor().hasSelection() && m_preview)
m_preview->emitWordSelect(textCursor().selectedText());
@ -1003,7 +993,7 @@ void PreviewTextEdit::mouseDoubleClickEvent(QMouseEvent *event)
void PreviewTextEdit::print()
{
LOGDEB(("PreviewTextEdit::print\n"));
LOGDEB("PreviewTextEdit::print\n" );
if (!m_preview)
return;
@ -1016,3 +1006,4 @@ void PreviewTextEdit::print()
QTextEdit::print(&printer);
#endif
}

View file

@ -34,7 +34,7 @@ using namespace std;
#include <qlayout.h>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "conftree.h"
@ -133,3 +133,4 @@ void EditTrans::on_transTW_itemSelectionChanged()
else
delPB->setEnabled(1);
}

View file

@ -22,7 +22,7 @@
#include "recoll.h"
#include "rclhelp.h"
#include "debuglog.h"
#include "log.h"
map<string, string> HelpClient::helpmap;
@ -42,7 +42,7 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
static time_t last_start;
if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::ShortcutOverride) {
// LOGDEB(("HelpClient::eventFilter: %d\n", (int)event->type()));
// LOGDEB("HelpClient::eventFilter: " << ((int)event->type()) << "\n" );
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_F1 || ke->key() == Qt::Key_Help) {
if (obj->isWidgetType()) {
@ -57,11 +57,10 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
if (time(0) - last_start > 5) {
last_start = time(0);
if (it != helpmap.end()) {
LOGDEB(("HelpClient::eventFilter: %s->%s\n",
it->first.c_str(), it->second.c_str()));
LOGDEB("HelpClient::eventFilter: " << (it->first) << "->" << (it->second) << "\n" );
startManual(it->second);
} else {
LOGDEB(("HelpClient::eventFilter: no help section\n"));
LOGDEB("HelpClient::eventFilter: no help section\n" );
startManual("");
}
}
@ -71,3 +70,4 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
}
return false;
}

View file

@ -23,7 +23,7 @@
#include <QTimer>
#include "execmd.h"
#include "debuglog.h"
#include "log.h"
#include "transcode.h"
#include "indexer.h"
#include "rclmain_w.h"
@ -83,7 +83,7 @@ void RclMain::updateIdxStatus()
// indexing, a possible need to exit, and cleanup exited viewers
void RclMain::periodic100()
{
LOGDEB2(("Periodic100\n"));
LOGDEB2("Periodic100\n" );
if (m_idxproc) {
// An indexing process was launched. If its' done, see status.
int status;
@ -268,7 +268,7 @@ void RclMain::rebuildIndex()
case IXST_NOTRUNNING:
{
if (m_idxproc) {
LOGERR(("RclMain::rebuildIndex: current indexer exec not null\n"));
LOGERR("RclMain::rebuildIndex: current indexer exec not null\n" );
return;
}
int rep =
@ -354,7 +354,7 @@ static string execToString(const string& cmd, const vector<string>& args)
void RclMain::specialIndex()
{
LOGDEB(("RclMain::specialIndex\n"));
LOGDEB("RclMain::specialIndex\n" );
switch (m_indexerState) {
case IXST_UNKNOWN:
case IXST_RUNNINGMINE:
@ -365,7 +365,7 @@ void RclMain::specialIndex()
break;
}
if (m_idxproc) {
LOGERR(("RclMain::rebuildIndex: current indexer exec not null\n"));
LOGERR("RclMain::rebuildIndex: current indexer exec not null\n" );
return;
}
if (!specidx) // ??
@ -418,8 +418,7 @@ void RclMain::specialIndex()
args.push_back(top);
}
m_idxproc = new ExecCmd;
LOGINFO(("specialIndex: exec: %s\n",
execToString("recollindex", args).c_str()));
LOGINFO("specialIndex: exec: " << execToString("recollindex", args) <<endl);
m_idxproc->startExec("recollindex", args, false, false);
}
@ -449,3 +448,4 @@ void RclMain::updateIdxForDocs(vector<Rcl::Doc>& docs)
actionSpecial_Indexing->setEnabled(false);
}

View file

@ -19,7 +19,7 @@
#include <QMessageBox>
#include <QShortcut>
#include "debuglog.h"
#include "log.h"
#include "internfile.h"
#include "rclzg.h"
#include "rclmain_w.h"
@ -31,12 +31,12 @@ static const QKeySequence quitKeySeq("Ctrl+q");
// where the current one is closed
void RclMain::previewClosed(Preview *w)
{
LOGDEB(("RclMain::previewClosed(%p)\n", w));
LOGDEB("RclMain::previewClosed(" << (w) << ")\n" );
if (w == curPreview) {
LOGDEB(("Active preview closed\n"));
LOGDEB("Active preview closed\n" );
curPreview = 0;
} else {
LOGDEB(("Old preview closed\n"));
LOGDEB("Old preview closed\n" );
}
delete w;
}
@ -114,7 +114,7 @@ bool RclMain::containerUpToDate(Rcl::Doc& doc)
QMessageBox::Cancel : QMessageBox::NoButton);
if (m_indexerState == IXST_NOTRUNNING && rep == QMessageBox::Ok) {
LOGDEB(("Requesting index update for %s\n", doc.url.c_str()));
LOGDEB("Requesting index update for " << (doc.url) << "\n" );
vector<Rcl::Doc> docs(1, doc);
updateIdxForDocs(docs);
}
@ -135,7 +135,7 @@ bool RclMain::containerUpToDate(Rcl::Doc& doc)
*/
void RclMain::startPreview(int docnum, Rcl::Doc doc, int mod)
{
LOGDEB(("startPreview(%d, doc, %d)\n", docnum, mod));
LOGDEB("startPreview(" << (docnum) << ", doc, " << (mod) << ")\n" );
if (!containerUpToDate(doc))
return;
@ -221,8 +221,7 @@ void RclMain::previewPrevInTab(Preview * w, int sid, int docnum)
// Combined next/prev from result list in current preview tab
void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
{
LOGDEB(("RclMain::previewNextInTab sid %d docnum %d, listId %d\n",
sid, docnum, reslist->listId()));
LOGDEB("RclMain::previewNextInTab sid " << (sid) << " docnum " << (docnum) << ", listId " << (reslist->listId()) << "\n" );
if (w == 0) // ??
return;
@ -256,10 +255,10 @@ void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
// displayed result list, tell reslist (to color the paragraph)
void RclMain::previewExposed(Preview *, int sid, int docnum)
{
LOGDEB2(("RclMain::previewExposed: sid %d docnum %d, m_sid %d\n",
sid, docnum, reslist->listId()));
LOGDEB2("RclMain::previewExposed: sid " << (sid) << " docnum " << (docnum) << ", m_sid " << (reslist->listId()) << "\n" );
if (sid != reslist->listId()) {
return;
}
reslist->previewExposed(docnum);
}

View file

@ -25,7 +25,7 @@
#include <QFileDialog>
#include "rclmain_w.h"
#include "debuglog.h"
#include "log.h"
#include "readfile.h"
#include "xmltosd.h"
#include "searchdata.h"
@ -88,7 +88,7 @@ void RclMain::saveLastQuery()
string tofile((const char *)s.toLocal8Bit());
LOGDEB(("RclMain::saveLastQuery: XML: [%s]\n", xml.c_str()));
LOGDEB("RclMain::saveLastQuery: XML: [" << (xml) << "]\n" );
string reason;
if (!stringtofile(xml, tofile.c_str(), reason)) {
QMessageBox::warning(this, tr("Write failed"),
@ -132,3 +132,4 @@ void RclMain::loadSavedQuery()
QMessageBox::warning(this, tr("Load error"),
tr("Could not load saved query"));
}

View file

@ -24,7 +24,7 @@
#include "qxtconfirmationmessage.h"
#include "debuglog.h"
#include "log.h"
#include "fileudi.h"
#include "execmd.h"
#include "transcode.h"
@ -47,9 +47,7 @@ void RclMain::viewUrl()
return;
QUrl qurl(m_urltoview);
LOGDEB(("RclMain::viewUrl: Path [%s] fragment [%s]\n",
(const char *)qurl.path().toLocal8Bit(),
(const char *)qurl.fragment().toLocal8Bit()));
LOGDEB("RclMain::viewUrl: Path [" << ((const char *)qurl.path().toLocal8Bit()) << "] fragment [" << ((const char *)qurl.fragment().toLocal8Bit()) << "]\n" );
/* In theory, the url might not be for a file managed by the fs
indexer so that the make_udi() call here would be
@ -124,7 +122,7 @@ static bool lookForHtmlBrowser(string &exefile)
void RclMain::openWith(Rcl::Doc doc, string cmdspec)
{
LOGDEB(("RclMain::openWith: %s\n", cmdspec.c_str()));
LOGDEB("RclMain::openWith: " << (cmdspec) << "\n" );
// Split the command line
vector<string> lcmd;
@ -159,11 +157,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
{
string apptag;
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
LOGDEB(("RclMain::startNativeViewer: mtype [%s] apptag [%s] page %d "
"term [%s] url [%s] ipath [%s]\n",
doc.mimetype.c_str(), apptag.c_str(), pagenum,
(const char *)(term.toUtf8()), doc.url.c_str(), doc.ipath.c_str()
));
LOGDEB("RclMain::startNativeViewer: mtype [" << (doc.mimetype) << "] apptag [" << (apptag) << "] page " << (pagenum) << " term [" << ((const char *)(term.toUtf8())) << "] url [" << (doc.url) << "] ipath [" << (doc.ipath) << "]\n" );
// Look for appropriate viewer
string cmdplusattr = theconfig->getMimeViewerDef(doc.mimetype, apptag,
@ -293,8 +287,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
bool enterHistory = false;
bool istempfile = false;
LOGDEB(("RclMain::startNV: groksipath %d wantsf %d wantsparentf %d\n",
groksipath, wantsfile, wantsparentfile));
LOGDEB("RclMain::startNV: groksipath " << (groksipath) << " wantsf " << (wantsfile) << " wantsparentf " << (wantsparentfile) << "\n" );
// If the command wants a file but this is not a file url, or
// there is an ipath that it won't understand, we need a temp file:
@ -409,7 +402,7 @@ void RclMain::execViewer(const map<string, string>& subs, bool enterHistory,
for (vector<string>::const_iterator it = _lcmd.begin();
it != _lcmd.end(); it++) {
pcSubst(*it, ncmd, subs);
LOGDEB(("%s->%s\n", it->c_str(), ncmd.c_str()));
LOGDEB("" << *it << "->" << (ncmd) << "\n" );
lcmd.push_back(ncmd);
}
@ -457,8 +450,7 @@ void RclMain::startManual(const string& index)
webhelp = path_cat(webhelp, "index.html");
bool has_wh = path_exists(webhelp);
LOGDEB(("RclMain::startManual: help index is %s\n",
index.empty()?"(null)":index.c_str()));
LOGDEB("RclMain::startManual: help index is " << (index.empty()?"(null)":index) << "\n" );
bool indexempty = index.empty();
#ifdef _WIN32
@ -481,3 +473,4 @@ void RclMain::startManual(const string& index)
doc.mimetype = "text/html";
startNativeViewer(doc);
}

View file

@ -19,7 +19,7 @@
#include <QShortcut>
#include <QMessageBox>
#include "debuglog.h"
#include "log.h"
#include "internfile.h"
#include "listdialog.h"
#include "confgui/confguiindex.h"
@ -171,7 +171,7 @@ void RclMain::execIndexConfig()
}
void RclMain::showIndexConfig(bool modal)
{
LOGDEB(("showIndexConfig()\n"));
LOGDEB("showIndexConfig()\n" );
if (indexConfig == 0) {
indexConfig = new ConfIndexW(0, theconfig);
connect(new QShortcut(quitKeySeq, indexConfig), SIGNAL (activated()),
@ -205,7 +205,7 @@ void RclMain::showIndexSched(bool modal)
"to update the index"));
return;
#endif
LOGDEB(("showIndexSched()\n"));
LOGDEB("showIndexSched()\n" );
if (indexSched == 0) {
indexSched = new IdxSchedW(this);
connect(new QShortcut(quitKeySeq, indexSched), SIGNAL (activated()),
@ -246,7 +246,7 @@ void RclMain::execCronTool()
}
void RclMain::showCronTool(bool modal)
{
LOGDEB(("showCronTool()\n"));
LOGDEB("showCronTool()\n" );
if (cronTool == 0) {
cronTool = new CronToolW(0);
connect(new QShortcut(quitKeySeq, cronTool), SIGNAL (activated()),
@ -273,7 +273,7 @@ void RclMain::execRTITool()
}
void RclMain::showRTITool(bool modal)
{
LOGDEB(("showRTITool()\n"));
LOGDEB("showRTITool()\n" );
if (rtiTool == 0) {
rtiTool = new RTIToolW(0);
connect(new QShortcut(quitKeySeq, rtiTool), SIGNAL (activated()),
@ -453,3 +453,4 @@ void RclMain::showSnippets(Rcl::Doc doc)
sp, SLOT (close()));
sp->show();
}

View file

@ -43,7 +43,7 @@
#include <QToolBar>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "mimehandler.h"
#include "pathut.h"
#include "smallut.h"
@ -585,7 +585,7 @@ void RclMain::initDbOpen()
void RclMain::setStemLang(QAction *id)
{
LOGDEB(("RclMain::setStemLang(%p)\n", id));
LOGDEB("RclMain::setStemLang(" << (id) << ")\n" );
// Check that the menu entry is for a stemming language change
// (might also be "show prefs" etc.
bool isLangId = false;
@ -615,8 +615,7 @@ void RclMain::setStemLang(QAction *id)
lang = id->text();
}
prefs.queryStemLang = lang;
LOGDEB(("RclMain::setStemLang(%d): lang [%s]\n",
id, (const char *)prefs.queryStemLang.toUtf8()));
LOGDEB("RclMain::setStemLang(" << (id) << "): lang [" << ((const char *)prefs.queryStemLang.toUtf8()) << "]\n" );
rwSettings(true);
emit stemLangChanged(lang);
}
@ -624,7 +623,7 @@ void RclMain::setStemLang(QAction *id)
// Set the checked stemming language item before showing the prefs menu
void RclMain::setStemLang(const QString& lang)
{
LOGDEB(("RclMain::setStemLang(%s)\n", (const char *)lang.toUtf8()));
LOGDEB("RclMain::setStemLang(" << ((const char *)lang.toUtf8()) << ")\n" );
QAction *id;
if (lang == "") {
id = m_idNoStem;
@ -658,7 +657,7 @@ void RclMain::showTrayMessage(const QString& text)
void RclMain::closeEvent(QCloseEvent *ev)
{
LOGDEB(("RclMain::closeEvent\n"));
LOGDEB("RclMain::closeEvent\n" );
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
hide();
ev->ignore();
@ -669,7 +668,7 @@ void RclMain::closeEvent(QCloseEvent *ev)
void RclMain::fileExit()
{
LOGDEB(("RclMain: fileExit\n"));
LOGDEB("RclMain: fileExit\n" );
// Don't save geometry if we're currently fullscreened
if (!isFullScreen()) {
prefs.mainwidth = width();
@ -697,10 +696,9 @@ void RclMain::fileExit()
// Start a db query and set the reslist docsource
void RclMain::startSearch(STD_SHARED_PTR<Rcl::SearchData> sdata, bool issimple)
{
LOGDEB(("RclMain::startSearch. Indexing %s Active %d\n",
m_idxproc?"on":"off", m_queryActive));
LOGDEB("RclMain::startSearch. Indexing " << (m_idxproc?"on":"off") << " Active " << (m_queryActive) << "\n" );
if (m_queryActive) {
LOGDEB(("startSearch: already active\n"));
LOGDEB("startSearch: already active\n" );
return;
}
m_queryActive = true;
@ -749,18 +747,15 @@ void RclMain::startSearch(STD_SHARED_PTR<Rcl::SearchData> sdata, bool issimple)
}
class QueryThread : public QThread {
int loglevel;
STD_SHARED_PTR<DocSequence> m_source;
public:
QueryThread(STD_SHARED_PTR<DocSequence> source)
: m_source(source)
{
loglevel = DebugLog::getdbl()->getlevel();
}
~QueryThread() { }
virtual void run()
{
DebugLog::getdbl()->setloglevel(loglevel);
cnt = m_source->getResCnt();
}
int cnt;
@ -830,7 +825,7 @@ void RclMain::onSortCtlChanged()
if (m_sortspecnochange)
return;
LOGDEB(("RclMain::onSortCtlChanged()\n"));
LOGDEB("RclMain::onSortCtlChanged()\n" );
m_sortspec.reset();
if (actionSortByDateAsc->isChecked()) {
m_sortspec.field = "mtime";
@ -856,7 +851,7 @@ void RclMain::onSortCtlChanged()
void RclMain::onSortDataChanged(DocSeqSortSpec spec)
{
LOGDEB(("RclMain::onSortDataChanged\n"));
LOGDEB("RclMain::onSortDataChanged\n" );
m_sortspecnochange = true;
if (spec.field.compare("mtime")) {
actionSortByDateDesc->setChecked(false);
@ -879,7 +874,7 @@ void RclMain::onSortDataChanged(DocSeqSortSpec spec)
void RclMain::on_actionShowResultsAsTable_toggled(bool on)
{
LOGDEB(("RclMain::on_actionShowResultsAsTable_toggled(%d)\n", int(on)));
LOGDEB("RclMain::on_actionShowResultsAsTable_toggled(" << (int(on)) << ")\n" );
prefs.showResultsAsTable = on;
displayingTable = on;
restable->setVisible(on);
@ -908,7 +903,7 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on)
void RclMain::on_actionSortByDateAsc_toggled(bool on)
{
LOGDEB(("RclMain::on_actionSortByDateAsc_toggled(%d)\n", int(on)));
LOGDEB("RclMain::on_actionSortByDateAsc_toggled(" << (int(on)) << ")\n" );
if (on) {
if (actionSortByDateDesc->isChecked()) {
actionSortByDateDesc->setChecked(false);
@ -921,7 +916,7 @@ void RclMain::on_actionSortByDateAsc_toggled(bool on)
void RclMain::on_actionSortByDateDesc_toggled(bool on)
{
LOGDEB(("RclMain::on_actionSortByDateDesc_toggled(%d)\n", int(on)));
LOGDEB("RclMain::on_actionSortByDateDesc_toggled(" << (int(on)) << ")\n" );
if (on) {
if (actionSortByDateAsc->isChecked()) {
actionSortByDateAsc->setChecked(false);
@ -951,7 +946,7 @@ void RclMain::saveDocToFile(Rcl::Doc doc)
void RclMain::showSubDocs(Rcl::Doc doc)
{
LOGDEB(("RclMain::showSubDocs\n"));
LOGDEB("RclMain::showSubDocs\n" );
string reason;
if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
@ -980,14 +975,14 @@ void RclMain::showSubDocs(Rcl::Doc doc)
// significant terms, and add them to the simple search entry.
void RclMain::docExpand(Rcl::Doc doc)
{
LOGDEB(("RclMain::docExpand()\n"));
LOGDEB("RclMain::docExpand()\n" );
if (!rcldb)
return;
list<string> terms;
terms = m_source->expand(doc);
if (terms.empty()) {
LOGDEB(("RclMain::docExpand: no terms\n"));
LOGDEB("RclMain::docExpand: no terms\n" );
return;
}
// Do we keep the original query. I think we'd better not.
@ -1006,7 +1001,7 @@ void RclMain::docExpand(Rcl::Doc doc)
void RclMain::showDocHistory()
{
LOGDEB(("RclMain::showDocHistory\n"));
LOGDEB("RclMain::showDocHistory\n" );
emit searchReset();
m_source = STD_SHARED_PTR<DocSequence>();
curPreview = 0;
@ -1062,7 +1057,7 @@ void RclMain::setUIPrefs()
{
if (!uiprefs)
return;
LOGDEB(("Recollmain::setUIPrefs\n"));
LOGDEB("Recollmain::setUIPrefs\n" );
reslist->setFont();
sSearch->setPrefs();
enbSynAction->setDisabled(prefs.synFile.isEmpty());
@ -1100,7 +1095,7 @@ void RclMain::catgFilter(QAction *act)
// User pressed a filter button: set filter params in reslist
void RclMain::catgFilter(int id)
{
LOGDEB(("RclMain::catgFilter: id %d\n", id));
LOGDEB("RclMain::catgFilter: id " << (id) << "\n" );
if (id < 0 || id >= int(m_catgbutvec.size()))
return;
@ -1173,3 +1168,4 @@ void RclMain::applyStyleSheet()
{
::applyStyleSheet(prefs.qssFile);
}

View file

@ -20,7 +20,7 @@
#include "rclzg.h"
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include <QString>
@ -78,9 +78,9 @@ void zg_send_event(ZgSendType, const Rcl::Doc& doc)
QtZeitgeist::DataModel::EventList events;
events.push_back(event);
LOGDEB(("zg_send_event, sending for %s %s\n",
doc.mimetype.c_str(), doc.url.c_str()));
LOGDEB("zg_send_event, sending for " << (doc.mimetype) << " " << (doc.url) << "\n" );
zglogger.insertEvents(events);
}
#endif

View file

@ -6,6 +6,7 @@ DEFINES += BUILDING_RECOLL
@QMAKE_ENABLE_WEBKIT@ QT += webkit
@QMAKE_DISABLE_WEBKIT@ QMAKE_CXXFLAGS += -DRESLIST_TEXTBROWSER -DSNIPPETS_TEXTBROWSER
QMAKE_CXXFLAGS += -std=c++11
@QMAKE_ENABLE_ZEITGEIST@ QT += dbus
@QMAKE_ENABLE_ZEITGEIST@ QMAKE_CXXFLAGS += -DUSE_ZEITGEIST

View file

@ -38,7 +38,7 @@
//#include <qx11info_x11.h>
#endif
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "recoll.h"
#include "guiutils.h"
@ -116,7 +116,7 @@ void logdata(const char *data)
// /// QtGuiResListPager methods:
bool QtGuiResListPager::append(const string& data)
{
LOGDEB2(("QtGuiReslistPager::appendString : %s\n", data.c_str()));
LOGDEB2("QtGuiReslistPager::appendString : " << (data) << "\n" );
logdata(data.c_str());
m_reslist->append(QString::fromUtf8(data.c_str()));
return true;
@ -125,8 +125,7 @@ bool QtGuiResListPager::append(const string& data)
bool QtGuiResListPager::append(const string& data, int docnum,
const Rcl::Doc&)
{
LOGDEB2(("QtGuiReslistPager::appendDoc: blockCount %d, %s\n",
m_reslist->document()->blockCount(), data.c_str()));
LOGDEB2("QtGuiReslistPager::appendDoc: blockCount " << (m_reslist->document()->blockCount()) << ", " << (data) << "\n" );
logdata(data.c_str());
#ifdef RESLIST_TEXTBROWSER
int blkcnt0 = m_reslist->document()->blockCount();
@ -208,7 +207,7 @@ void QtGuiResListPager::suggest(const vector<string>uterms,
if (noaspell)
return;
if (!aspell) {
LOGERR(("QtGuiResListPager:: aspell not initialized\n"));
LOGERR("QtGuiResListPager:: aspell not initialized\n" );
return;
}
@ -225,8 +224,7 @@ void QtGuiResListPager::suggest(const vector<string>uterms,
// frequencies and propose something anyway if a possible
// variation is much more common (as google does) ?
if (!aspell->suggest(*rcldb, *uit, asuggs, reason)) {
LOGERR(("QtGuiResListPager::suggest: aspell failed: %s\n",
reason.c_str()));
LOGERR("QtGuiResListPager::suggest: aspell failed: " << (reason) << "\n" );
continue;
}
@ -261,16 +259,15 @@ string QtGuiResListPager::iconUrl(RclConfig *config, Rcl::Doc& doc)
ConfIndexer::docsToPaths(docs, paths);
if (!paths.empty()) {
string path;
LOGDEB0(("ResList::iconUrl: source path [%s]\n", paths[0].c_str()));
LOGDEB0("ResList::iconUrl: source path [" << (paths[0]) << "]\n" );
if (thumbPathForUrl(cstr_fileu + paths[0], 128, path)) {
LOGDEB0(("ResList::iconUrl: icon path [%s]\n", path.c_str()));
LOGDEB0("ResList::iconUrl: icon path [" << (path) << "]\n" );
return cstr_fileu + path;
} else {
LOGDEB0(("ResList::iconUrl: no icon: path [%s]\n",
path.c_str()));
LOGDEB0("ResList::iconUrl: no icon: path [" << (path) << "]\n" );
}
} else {
LOGDEB(("ResList::iconUrl: docsToPaths failed\n"));
LOGDEB("ResList::iconUrl: docsToPaths failed\n" );
}
}
return ResListPager::iconUrl(config, doc);
@ -286,7 +283,7 @@ public:
string s1, s2;
stringsToString<vector<string> >(m_hdata->groups[idx], s1);
stringsToString<vector<string> >(m_hdata->ugroups[m_hdata->grpsugidx[idx]], s2);
LOGDEB(("Reslist startmatch: group %s user group %s\n", s1.c_str(), s2.c_str()));
LOGDEB("Reslist startmatch: group " << (s1) << " user group " << (s2) << "\n" );
}
return string("<span class='rclmatch' style='color: ")
@ -310,7 +307,7 @@ ResList::ResList(QWidget* parent, const char* name)
else
setObjectName(name);
#ifdef RESLIST_TEXTBROWSER
LOGDEB(("Reslist: using QTextBrowser\n"));
LOGDEB("Reslist: using QTextBrowser\n" );
setReadOnly(TRUE);
setUndoRedoEnabled(FALSE);
setOpenLinks(FALSE);
@ -319,7 +316,7 @@ ResList::ResList(QWidget* parent, const char* name)
connect(this, SIGNAL(anchorClicked(const QUrl &)),
this, SLOT(linkWasClicked(const QUrl &)));
#else
LOGDEB(("Reslist: using QWebView\n"));
LOGDEB("Reslist: using QWebView\n" );
// signals and slots connections
connect(this, SIGNAL(linkClicked(const QUrl &)),
this, SLOT(linkWasClicked(const QUrl &)));
@ -426,7 +423,7 @@ extern "C" int XFlush(void *);
void ResList::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
{
LOGDEB(("ResList::setDocSource()\n"));
LOGDEB("ResList::setDocSource()\n" );
m_source = STD_SHARED_PTR<DocSequence>(new DocSource(theconfig, nsource));
}
@ -434,7 +431,7 @@ void ResList::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
// re-read the results.
void ResList::readDocSource()
{
LOGDEB(("ResList::readDocSource()\n"));
LOGDEB("ResList::readDocSource()\n" );
resetView();
if (!m_source)
return;
@ -449,7 +446,7 @@ void ResList::readDocSource()
void ResList::resetList()
{
LOGDEB(("ResList::resetList()\n"));
LOGDEB("ResList::resetList()\n" );
setDocSource(STD_SHARED_PTR<DocSequence>());
resetView();
}
@ -513,15 +510,14 @@ int ResList::docnumfromparnum(int block)
// Get range of paragraph numbers which make up the result for document number
pair<int,int> ResList::parnumfromdocnum(int docnum)
{
LOGDEB(("parnumfromdocnum: docnum %d\n", docnum));
LOGDEB("parnumfromdocnum: docnum " << (docnum) << "\n" );
if (m_pager->pageNumber() < 0) {
LOGDEB(("parnumfromdocnum: no page return -1,-1\n"));
LOGDEB("parnumfromdocnum: no page return -1,-1\n" );
return pair<int,int>(-1,-1);
}
int winfirst = pageFirstDocNum();
if (docnum - winfirst < 0) {
LOGDEB(("parnumfromdocnum: docnum %d < winfirst %d return -1,-1\n",
docnum, winfirst));
LOGDEB("parnumfromdocnum: docnum " << (docnum) << " < winfirst " << (winfirst) << " return -1,-1\n" );
return pair<int,int>(-1,-1);
}
docnum -= winfirst;
@ -535,11 +531,11 @@ pair<int,int> ResList::parnumfromdocnum(int docnum)
m_pageParaToReldocnums.end() && it1->second == docnum) {
last++;
}
LOGDEB(("parnumfromdocnum: return %d,%d\n", first, last));
LOGDEB("parnumfromdocnum: return " << (first) << "," << (last) << "\n" );
return pair<int,int>(first, last);
}
}
LOGDEB(("parnumfromdocnum: not found return -1,-1\n"));
LOGDEB("parnumfromdocnum: not found return -1,-1\n" );
return pair<int,int>(-1,-1);
}
#endif // TEXTBROWSER
@ -550,8 +546,7 @@ pair<int,int> ResList::parnumfromdocnum(int docnum)
// result in a one-page change.
bool ResList::getDoc(int docnum, Rcl::Doc &doc)
{
LOGDEB(("ResList::getDoc: docnum %d winfirst %d\n", docnum,
pageFirstDocNum()));
LOGDEB("ResList::getDoc: docnum " << (docnum) << " winfirst " << (pageFirstDocNum()) << "\n" );
int winfirst = pageFirstDocNum();
int winlast = m_pager->pageLastDocNum();
if (docnum < 0 || winfirst < 0 || winlast < 0)
@ -641,8 +636,7 @@ void ResList::resPageDownOrNext()
#ifdef RESLIST_TEXTBROWSER
int vpos = verticalScrollBar()->value();
verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
LOGDEB(("ResList::resPageDownOrNext: vpos before %d, after %d\n",
vpos, verticalScrollBar()->value()));
LOGDEB("ResList::resPageDownOrNext: vpos before " << (vpos) << ", after " << (verticalScrollBar()->value()) << "\n" );
if (vpos == verticalScrollBar()->value())
resultPageNext();
#else
@ -675,9 +669,9 @@ bool ResList::scrollIsAtBottom()
int max = frame->scrollBarMaximum(Qt::Vertical);
int cur = frame->scrollBarValue(Qt::Vertical);
ret = (max != 0) && (cur == max);
LOGDEB2(("Scrollatbottom: cur %d max %d\n", cur, max));
LOGDEB2("Scrollatbottom: cur " << (cur) << " max " << (max) << "\n" );
}
LOGDEB2(("scrollIsAtBottom: returning %d\n", ret));
LOGDEB2("scrollIsAtBottom: returning " << (ret) << "\n" );
return ret;
#endif
}
@ -694,10 +688,10 @@ bool ResList::scrollIsAtTop()
} else {
int cur = frame->scrollBarValue(Qt::Vertical);
int min = frame->scrollBarMinimum(Qt::Vertical);
LOGDEB(("Scrollattop: cur %d min %d\n", cur, min));
LOGDEB("Scrollattop: cur " << (cur) << " min " << (min) << "\n" );
ret = (cur == min);
}
LOGDEB2(("scrollIsAtTop: returning %d\n", ret));
LOGDEB2("scrollIsAtTop: returning " << (ret) << "\n" );
return ret;
#endif
}
@ -738,8 +732,7 @@ void ResList::resultPageFor(int docnum)
void ResList::append(const QString &text)
{
LOGDEB2(("QtGuiReslistPager::appendQString : %s\n",
(const char*)text.toUtf8()));
LOGDEB2("QtGuiReslistPager::appendQString : " << ((const char*)text.toUtf8()) << "\n" );
#ifdef RESLIST_TEXTBROWSER
QTextBrowser::append(text);
#else
@ -757,9 +750,7 @@ void ResList::displayPage()
setHtml(m_text);
#endif
LOGDEB0(("ResList::displayPg: hasNext %d atBot %d hasPrev %d at Top %d \n",
m_pager->hasPrev(), scrollIsAtBottom(),
m_pager->hasNext(), scrollIsAtTop()));
LOGDEB0("ResList::displayPg: hasNext " << (m_pager->hasPrev()) << " atBot " << (scrollIsAtBottom()) << " hasPrev " << (m_pager->hasNext()) << " at Top " << (scrollIsAtTop()) << " \n" );
setupArrows();
// Possibly color paragraph of current preview if any
@ -769,7 +760,7 @@ void ResList::displayPage()
// Color paragraph (if any) of currently visible preview
void ResList::previewExposed(int docnum)
{
LOGDEB(("ResList::previewExposed: doc %d\n", docnum));
LOGDEB("ResList::previewExposed: doc " << (docnum) << "\n" );
// Possibly erase old one to white
if (m_curPvDoc != -1) {
@ -788,14 +779,13 @@ void ResList::previewExposed(int docnum)
#else
QString sel =
QString("div[rcldocnum=\"%1\"]").arg(m_curPvDoc - pageFirstDocNum());
LOGDEB2(("Searching for element, selector: [%s]\n",
qs2utf8s(sel).c_str()));
LOGDEB2("Searching for element, selector: [" << (qs2utf8s(sel)) << "]\n" );
QWebElement elt = page()->mainFrame()->findFirstElement(sel);
if (!elt.isNull()) {
LOGDEB2(("Found\n"));
LOGDEB2("Found\n" );
elt.removeAttribute("style");
} else {
LOGDEB2(("Not Found\n"));
LOGDEB2("Not Found\n" );
}
#endif
m_curPvDoc = -1;
@ -825,14 +815,13 @@ void ResList::previewExposed(int docnum)
#else
QString sel =
QString("div[rcldocnum=\"%1\"]").arg(docnum - pageFirstDocNum());
LOGDEB2(("Searching for element, selector: [%s]\n",
qs2utf8s(sel).c_str()));
LOGDEB2("Searching for element, selector: [" << (qs2utf8s(sel)) << "]\n" );
QWebElement elt = page()->mainFrame()->findFirstElement(sel);
if (!elt.isNull()) {
LOGDEB2(("Found\n"));
LOGDEB2("Found\n" );
elt.setAttribute("style", "background: LightBlue;}");
} else {
LOGDEB2(("Not Found\n"));
LOGDEB2("Not Found\n" );
}
#endif
}
@ -864,7 +853,7 @@ void ResList::showQueryDetails()
void ResList::linkWasClicked(const QUrl &url)
{
string ascurl = qs2utf8s(url.toString());
LOGDEB(("ResList::linkWasClicked: [%s]\n", ascurl.c_str()));
LOGDEB("ResList::linkWasClicked: [" << (ascurl) << "]\n" );
int what = ascurl[0];
switch (what) {
@ -877,7 +866,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
emit(showSnippets(doc));
@ -892,7 +881,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
vector<Rcl::Doc> dups;
@ -908,7 +897,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
emit editRequested(ResultPopup::getParent(STD_SHARED_PTR<DocSequence>(),
@ -930,7 +919,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
if (what == 'P') {
@ -990,18 +979,18 @@ void ResList::linkWasClicked(const QUrl &url)
break;
default:
LOGERR(("ResList::linkWasClicked: bad link [%s]\n", ascurl.c_str()));
LOGERR("ResList::linkWasClicked: bad link [" << (ascurl) << "]\n" );
break;// ??
}
}
void ResList::createPopupMenu(const QPoint& pos)
{
LOGDEB(("ResList::createPopupMenu(%d, %d)\n", pos.x(), pos.y()));
LOGDEB("ResList::createPopupMenu(" << (pos.x()) << ", " << (pos.y()) << ")\n" );
#ifdef RESLIST_TEXTBROWSER
QTextCursor cursor = cursorForPosition(pos);
int blocknum = cursor.blockNumber();
LOGDEB(("ResList::createPopupMenu(): block %d\n", blocknum));
LOGDEB("ResList::createPopupMenu(): block " << (blocknum) << "\n" );
m_popDoc = docnumfromparnum(blocknum);
#else
QWebHitTestResult htr = page()->mainFrame()->hitTestContent(pos);
@ -1122,3 +1111,4 @@ int ResList::pageFirstDocNum()
{
return m_pager->pageFirstDocNum();
}

View file

@ -20,7 +20,7 @@
#include <qmenu.h>
#include <qclipboard.h>
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "recoll.h"
#include "docseq.h"
@ -33,10 +33,8 @@ QMenu *create(QWidget *me, int opts, STD_SHARED_PTR<DocSequence> source, Rcl::Do
{
QMenu *popup = new QMenu(me);
LOGDEB(("ResultPopup::create: opts %x haspages %d %s %s\n", opts,
doc.haspages, source ? "Source not null" : "Source is Null",
source ? (source->snippetsCapable() ?
"snippetsCapable" : "not snippetsCapable") : ""));
LOGDEB("ResultPopup::create: opts " << (opts) << " haspages " << (doc.haspages) << " " << (source ? "Source not null" : "Source is Null") << " " << (source ? (source->snippetsCapable() ?
"snippetsCapable" : "not snippetsCapable") : "") << "\n" );
string apptag;
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
@ -175,3 +173,4 @@ void copyURL(const Rcl::Doc &doc)
}
}

View file

@ -37,7 +37,7 @@
#include "recoll.h"
#include MEMORY_INCLUDE
#include "docseq.h"
#include "debuglog.h"
#include "log.h"
#include "restable.h"
#include "guiutils.h"
#include "reslistpager.h"
@ -271,7 +271,7 @@ RecollModel::RecollModel(const QStringList fields, QObject *parent)
int RecollModel::rowCount(const QModelIndex&) const
{
LOGDEB2(("RecollModel::rowCount\n"));
LOGDEB2("RecollModel::rowCount\n" );
if (!m_source)
return 0;
return m_source->getResCnt();
@ -279,20 +279,20 @@ int RecollModel::rowCount(const QModelIndex&) const
int RecollModel::columnCount(const QModelIndex&) const
{
LOGDEB2(("RecollModel::columnCount\n"));
LOGDEB2("RecollModel::columnCount\n" );
return m_fields.size();
}
void RecollModel::readDocSource()
{
LOGDEB(("RecollModel::readDocSource()\n"));
LOGDEB("RecollModel::readDocSource()\n" );
beginResetModel();
endResetModel();
}
void RecollModel::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
{
LOGDEB(("RecollModel::setDocSource\n"));
LOGDEB("RecollModel::setDocSource\n" );
if (!nsource) {
m_source = STD_SHARED_PTR<DocSequence>();
} else {
@ -317,7 +317,7 @@ void RecollModel::deleteColumn(int col)
void RecollModel::addColumn(int col, const string& field)
{
LOGDEB(("AddColumn: col %d fld [%s]\n", col, field.c_str()));
LOGDEB("AddColumn: col " << (col) << " fld [" << (field) << "]\n" );
if (col >= 0 && col < int(m_fields.size())) {
col++;
vector<string>::iterator it = m_fields.begin();
@ -335,8 +335,7 @@ void RecollModel::addColumn(int col, const string& field)
QVariant RecollModel::headerData(int idx, Qt::Orientation orientation,
int role) const
{
LOGDEB2(("RecollModel::headerData: idx %d orientation %s role %d\n",
idx, orientation == Qt::Vertical ? "vertical":"horizontal", role));
LOGDEB2("RecollModel::headerData: idx " << (idx) << " orientation " << (orientation == Qt::Vertical ? "vertical":"horizontal") << " role " << (role) << "\n" );
if (orientation == Qt::Vertical && role == Qt::DisplayRole) {
return idx;
}
@ -354,8 +353,7 @@ QVariant RecollModel::headerData(int idx, Qt::Orientation orientation,
QVariant RecollModel::data(const QModelIndex& index, int role) const
{
LOGDEB2(("RecollModel::data: row %d col %d role %d\n", index.row(),
index.column(), role));
LOGDEB2("RecollModel::data: row " << (index.row()) << " col " << (index.column()) << " role " << (role) << "\n" );
if (!m_source || role != Qt::DisplayRole || !index.isValid() ||
index.column() >= int(m_fields.size())) {
return QVariant();
@ -410,7 +408,7 @@ void RecollModel::sort(int column, Qt::SortOrder order)
{
if (m_ignoreSort)
return;
LOGDEB(("RecollModel::sort(%d, %d)\n", column, int(order)));
LOGDEB("RecollModel::sort(" << (column) << ", " << (int(order)) << ")\n" );
DocSeqSortSpec spec;
if (column >= 0 && column < int(m_fields.size())) {
@ -592,7 +590,7 @@ int ResTable::getDetailDocNumOrTopRow()
void ResTable::makeRowVisible(int row)
{
LOGDEB(("ResTable::showRow(%d)\n", row));
LOGDEB("ResTable::showRow(" << (row) << ")\n" );
QModelIndex modelIndex = m_model->index(row, 0);
tableView->scrollTo(modelIndex, QAbstractItemView::PositionAtTop);
tableView->selectionModel()->clear();
@ -611,7 +609,7 @@ void ResTable::saveColState()
QHeaderView *header = tableView->horizontalHeader();
const vector<string>& vf = m_model->getFields();
if (!header) {
LOGERR(("ResTable::saveColState: no table header ??\n"));
LOGERR("ResTable::saveColState: no table header ??\n" );
return;
}
@ -622,7 +620,7 @@ void ResTable::saveColState()
for (int vi = 0; vi < header->count(); vi++) {
int li = header->logicalIndex(vi);
if (li < 0 || li >= int(vf.size())) {
LOGERR(("saveColState: logical index beyond list size!\n"));
LOGERR("saveColState: logical index beyond list size!\n" );
continue;
}
newfields.push_back(QString::fromUtf8(vf[li].c_str()));
@ -634,8 +632,7 @@ void ResTable::saveColState()
void ResTable::onTableView_currentChanged(const QModelIndex& index)
{
LOGDEB2(("ResTable::onTableView_currentChanged(%d, %d)\n",
index.row(), index.column()));
LOGDEB2("ResTable::onTableView_currentChanged(" << (index.row()) << ", " << (index.column()) << ")\n" );
if (!m_model || !m_model->getDocSource())
return;
@ -653,21 +650,20 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index)
void ResTable::on_tableView_entered(const QModelIndex& index)
{
LOGDEB2(("ResTable::on_tableView_entered(%d, %d)\n",
index.row(), index.column()));
LOGDEB2("ResTable::on_tableView_entered(" << (index.row()) << ", " << (index.column()) << ")\n" );
if (!tableView->selectionModel()->hasSelection())
onTableView_currentChanged(index);
}
void ResTable::takeFocus()
{
// LOGDEB(("resTable: take focus\n"));
// LOGDEB("resTable: take focus\n" );
tableView->setFocus(Qt::ShortcutFocusReason);
}
void ResTable::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
{
LOGDEB(("ResTable::setDocSource\n"));
LOGDEB("ResTable::setDocSource\n" );
if (m_model)
m_model->setDocSource(nsource);
if (m_pager)
@ -679,13 +675,13 @@ void ResTable::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
void ResTable::resetSource()
{
LOGDEB(("ResTable::resetSource\n"));
LOGDEB("ResTable::resetSource\n" );
setDocSource(STD_SHARED_PTR<DocSequence>());
}
void ResTable::saveAsCSV()
{
LOGDEB(("ResTable::saveAsCSV\n"));
LOGDEB("ResTable::saveAsCSV\n" );
if (!m_model)
return;
QString s =
@ -709,8 +705,7 @@ void ResTable::saveAsCSV()
// This is called when the sort order is changed from another widget
void ResTable::onSortDataChanged(DocSeqSortSpec spec)
{
LOGDEB(("ResTable::onSortDataChanged: [%s] desc %d\n",
spec.field.c_str(), int(spec.desc)));
LOGDEB("ResTable::onSortDataChanged: [" << (spec.field) << "] desc " << (int(spec.desc)) << "\n" );
QHeaderView *header = tableView->horizontalHeader();
if (!header || !m_model)
return;
@ -734,7 +729,7 @@ void ResTable::onSortDataChanged(DocSeqSortSpec spec)
void ResTable::resetSort()
{
LOGDEB(("ResTable::resetSort()\n"));
LOGDEB("ResTable::resetSort()\n" );
QHeaderView *header = tableView->horizontalHeader();
if (header)
header->setSortIndicator(-1, Qt::AscendingOrder);
@ -745,7 +740,7 @@ void ResTable::resetSort()
void ResTable::readDocSource(bool resetPos)
{
LOGDEB(("ResTable::readDocSource(%d)\n", int(resetPos)));
LOGDEB("ResTable::readDocSource(" << (int(resetPos)) << ")\n" );
if (resetPos)
tableView->verticalScrollBar()->setSliderPosition(0);
@ -761,7 +756,7 @@ void ResTable::linkWasClicked(const QUrl &url)
}
QString s = url.toString();
const char *ascurl = s.toUtf8();
LOGDEB(("ResTable::linkWasClicked: [%s]\n", ascurl));
LOGDEB("ResTable::linkWasClicked: [" << (ascurl) << "]\n" );
int i = atoi(ascurl+1) -1;
int what = ascurl[0];
@ -821,7 +816,7 @@ void ResTable::linkWasClicked(const QUrl &url)
break;
default:
LOGERR(("ResTable::linkWasClicked: bad link [%s]\n", ascurl));
LOGERR("ResTable::linkWasClicked: bad link [" << (ascurl) << "]\n" );
break;// ??
}
}
@ -844,7 +839,7 @@ void ResTable::onDoubleClick(const QModelIndex& index)
void ResTable::createPopupMenu(const QPoint& pos)
{
LOGDEB(("ResTable::createPopupMenu: m_detaildocnum %d\n", m_detaildocnum));
LOGDEB("ResTable::createPopupMenu: m_detaildocnum " << (m_detaildocnum) << "\n" );
if (m_detaildocnum >= 0 && m_model) {
int opts = m_ismainres? ResultPopup::isMain : 0;
@ -975,7 +970,7 @@ void ResTable::menuShowSubDocs()
void ResTable::createHeaderPopupMenu(const QPoint& pos)
{
LOGDEB(("ResTable::createHeaderPopupMenu(%d, %d)\n", pos.x(), pos.y()));
LOGDEB("ResTable::createHeaderPopupMenu(" << (pos.x()) << ", " << (pos.y()) << ")\n" );
QHeaderView *header = tableView->horizontalHeader();
if (!header || !m_model)
return;
@ -1021,7 +1016,7 @@ void ResTable::addColumn()
if (!m_model)
return;
QAction *action = (QAction *)sender();
LOGDEB(("addColumn: text %s, data %s\n", qs2utf8s(action->text()).c_str(),
qs2utf8s(action->data().toString()).c_str()));
LOGDEB("addColumn: text " << (qs2utf8s(action->text())) << ", data " << (qs2utf8s(action->data().toString())) << "\n" );
m_model->addColumn(m_popcolumn, qs2utf8s(action->data().toString()));
}

View file

@ -17,8 +17,7 @@
#include "autoconfig.h"
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "searchclause_w.h"
#include <qvariant.h>
@ -142,7 +141,7 @@ SearchDataClause *SearchClauseW::getClause()
void SearchClauseW::setFromClause(SearchDataClauseSimple *cl)
{
LOGDEB(("SearchClauseW::setFromClause\n"));
LOGDEB("SearchClauseW::setFromClause\n" );
switch(cl->getTp()) {
case SCLT_OR: if (cl->getexclude()) tpChange(2); else tpChange(0); break;
case SCLT_AND: tpChange(1); break;
@ -151,7 +150,7 @@ void SearchClauseW::setFromClause(SearchDataClauseSimple *cl)
case SCLT_FILENAME: tpChange(5); break;
default: return;
}
LOGDEB(("SearchClauseW::setFromClause: calling erase\n"));
LOGDEB("SearchClauseW::setFromClause: calling erase\n" );
clear();
QString text = QString::fromUtf8(cl->gettext().c_str());
@ -220,3 +219,4 @@ void SearchClauseW::tpChange(int index)
fldCMB->show();
}
}

View file

@ -32,7 +32,7 @@ using namespace std;
#endif
#include <QShortcut>
#include "debuglog.h"
#include "log.h"
#include "recoll.h"
#include "snippets_w.h"
#include "guiutils.h"
@ -170,7 +170,7 @@ void SnippetsW::init()
}
list<string> lr;
if (!g_hiliter.plaintorich(it->snippet, lr, hdata)) {
LOGDEB1(("No match for [%s]\n", it->snippet.c_str()));
LOGDEB1("No match for [" << (it->snippet) << "]\n" );
continue;
}
nomatch = false;
@ -238,7 +238,7 @@ void SnippetsW::slotSearchTextChanged(const QString& txt)
void SnippetsW::linkWasClicked(const QUrl &url)
{
string ascurl = (const char *)url.toString().toUtf8();
LOGDEB(("Snippets::linkWasClicked: [%s]\n", ascurl.c_str()));
LOGDEB("Snippets::linkWasClicked: [" << (ascurl) << "]\n" );
if (ascurl.size() > 3) {
int what = ascurl[0];
@ -259,6 +259,7 @@ void SnippetsW::linkWasClicked(const QUrl &url)
}
}
}
LOGERR(("Snippets::linkWasClicked: bad link [%s]\n", ascurl.c_str()));
LOGERR("Snippets::linkWasClicked: bad link [" << (ascurl) << "]\n" );
}

View file

@ -35,7 +35,7 @@
#include <QClipboard>
#include <QKeyEvent>
#include "debuglog.h"
#include "log.h"
#include "recoll.h"
#include "spell_w.h"
#include "guiutils.h"
@ -147,7 +147,7 @@ void SpellW::doExpand()
string reason;
if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
LOGDEB(("SpellW::doExpand: db error: %s\n", reason.c_str()));
LOGDEB("SpellW::doExpand: db error: " << (reason) << "\n" );
return;
}
@ -178,7 +178,7 @@ void SpellW::doExpand()
string l_stemlang = qs2utf8s(stemLangCMB->currentText());
if (!rcldb->termMatch(mt, l_stemlang, expr, res, maxexpand)) {
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
LOGERR("SpellW::doExpand:rcldb::termMatch failed\n" );
return;
}
statsLBL->setText(tr("Index: %1 documents, average length %2 terms."
@ -192,19 +192,19 @@ void SpellW::doExpand()
#ifdef RCL_USE_ASPELL
case TYPECMB_ASPELL:
{
LOGDEB(("SpellW::doExpand: aspelling\n"));
LOGDEB("SpellW::doExpand: aspelling\n" );
if (!aspell) {
QMessageBox::warning(0, "Recoll",
tr("Aspell init failed. "
"Aspell not installed?"));
LOGDEB(("SpellW::doExpand: aspell init error\n"));
LOGDEB("SpellW::doExpand: aspell init error\n" );
return;
}
list<string> suggs;
if (!aspell->suggest(*rcldb, expr, suggs, reason)) {
QMessageBox::warning(0, "Recoll",
tr("Aspell expansion error. "));
LOGERR(("SpellW::doExpand:suggest failed: %s\n", reason.c_str()));
LOGERR("SpellW::doExpand:suggest failed: " << (reason) << "\n" );
}
for (list<string>::const_iterator it = suggs.begin();
it != suggs.end(); it++)
@ -253,7 +253,7 @@ void SpellW::doExpand()
for (vector<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
it != res.entries.end(); it++) {
LOGDEB2(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
LOGDEB2("SpellW::expand: " << (it->wcf) << " [" << (it->term) << "]\n" );
char num[30];
if (it->wcf)
sprintf(num, "%d / %d", it->docs, it->wcf);
@ -275,7 +275,7 @@ void SpellW::showStats()
Rcl::DbStats res;
if (!rcldb->dbStats(res)) {
LOGERR(("SpellW::doExpand:rcldb::dbStats failed\n"));
LOGERR("SpellW::doExpand:rcldb::dbStats failed\n" );
return;
}
@ -365,7 +365,7 @@ void SpellW::showStats()
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
Rcl::Query query(rcldb);
if (!query.setQuery(rq)) {
LOGERR(("Query setup failed: %s",query.getReason().c_str()));
LOGERR("Query setup failed: " << (query.getReason()) << "" );
return;
}
int cnt = query.getResCnt();
@ -521,3 +521,4 @@ bool SpellW::eventFilter(QObject *target, QEvent *event)
}
return false;
}

View file

@ -33,7 +33,7 @@
#include <QTimer>
#include <QCompleter>
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "searchdata.h"
#include "ssearch_w.h"
@ -95,7 +95,7 @@ void SSearch::init()
void SSearch::takeFocus()
{
LOGDEB2(("SSearch: take focus\n"));
LOGDEB2("SSearch: take focus\n" );
queryText->setFocus(Qt::ShortcutFocusReason);
// If the focus was already in the search entry, the text is not selected.
// Do it for consistency
@ -105,15 +105,14 @@ void SSearch::takeFocus()
void SSearch::timerDone()
{
QString qs = queryText->currentText();
LOGDEB1(("SSearch::timerDone: qs [%s]\n", qs2utf8s(qs).c_str()));
LOGDEB1("SSearch::timerDone: qs [" << (qs2utf8s(qs)) << "]\n" );
searchTextChanged(qs);
}
void SSearch::searchTextChanged(const QString& text)
{
QString qs = queryText->currentText();
LOGDEB1(("SSearch::searchTextChanged. ks %d qs [%s]\n",
m_keystroke, qs2utf8s(text).c_str()));
LOGDEB1("SSearch::searchTextChanged. ks " << (m_keystroke) << " qs [" << (qs2utf8s(text)) << "]\n" );
if (text.isEmpty()) {
searchPB->setEnabled(false);
clearqPB->setEnabled(false);
@ -130,8 +129,7 @@ void SSearch::searchTextChanged(const QString& text)
m_disableAutosearch = true;
string s;
int cs = partialWord(s);
LOGDEB1(("SSearch::searchTextChanged: autosearch. cs %d s [%s]\n",
cs, s.c_str()));
LOGDEB1("SSearch::searchTextChanged: autosearch. cs " << (cs) << " s [" << (s) << "]\n" );
if (cs < 0) {
startSimpleSearch();
} else if (!m_stroketimeout->isActive() && s.size() >= 2) {
@ -146,7 +144,7 @@ void SSearch::searchTextChanged(const QString& text)
void SSearch::searchTypeChanged(int typ)
{
LOGDEB(("Search type now %d\n", typ));
LOGDEB("Search type now " << (typ) << "\n" );
// Adjust context help
if (typ == SST_LANG)
HelpClient::installMap((const char *)this->objectName().toUtf8(),
@ -188,7 +186,7 @@ void SSearch::searchTypeChanged(int typ)
void SSearch::startSimpleSearch()
{
QString qs = queryText->currentText();
LOGDEB(("SSearch::startSimpleSearch(): qs [%s]\n", qs2utf8s(qs).c_str()));
LOGDEB("SSearch::startSimpleSearch(): qs [" << (qs2utf8s(qs)) << "]\n" );
if (qs.length() == 0)
return;
@ -201,7 +199,7 @@ void SSearch::startSimpleSearch()
if (!startSimpleSearch(u8))
return;
LOGDEB(("startSimpleSearch: updating history\n"));
LOGDEB("startSimpleSearch: updating history\n" );
// Search terms history:
// We want to have the new text at the top and any older identical
// entry to be erased. There is no standard qt policy to do this ?
@ -242,7 +240,7 @@ string SSearch::asXML()
bool SSearch::startSimpleSearch(const string& u8, int maxexp)
{
LOGDEB(("SSearch::startSimpleSearch(%s)\n", u8.c_str()));
LOGDEB("SSearch::startSimpleSearch(" << (u8) << ")\n" );
string stemlang = prefs.stemlang();
ostringstream xml;
@ -309,7 +307,7 @@ bool SSearch::startSimpleSearch(const string& u8, int maxexp)
xml << "</SD>\n";
m_xml = xml.str();
LOGDEB(("SSearch::startSimpleSearch:xml:[%s]\n", m_xml.c_str()));
LOGDEB("SSearch::startSimpleSearch:xml:[" << (m_xml) << "]\n" );
STD_SHARED_PTR<Rcl::SearchData> rsdata(sdata);
emit startSearch(rsdata, true);
@ -392,7 +390,7 @@ bool SSearch::hasSearchString()
static const char* punct = " \t()<>\"'[]{}!^*.,:;\n\r";
void SSearch::addTerm(QString term)
{
LOGDEB(("SSearch::AddTerm: [%s]\n", (const char *)term.toUtf8()));
LOGDEB("SSearch::AddTerm: [" << ((const char *)term.toUtf8()) << "]\n" );
string t = (const char *)term.toUtf8();
string::size_type pos = t.find_last_not_of(punct);
if (pos == string::npos)
@ -414,8 +412,7 @@ void SSearch::addTerm(QString term)
void SSearch::onWordReplace(const QString& o, const QString& n)
{
LOGDEB(("SSearch::onWordReplace: o [%s] n [%s]\n",
qs2utf8s(o).c_str(), qs2utf8s(n).c_str()));
LOGDEB("SSearch::onWordReplace: o [" << (qs2utf8s(o)) << "] n [" << (qs2utf8s(n)) << "]\n" );
QString txt = queryText->currentText();
QRegExp exp = QRegExp(QString("\\b") + o + QString("\\b"));
exp.setCaseSensitivity(Qt::CaseInsensitive);
@ -476,7 +473,7 @@ int SSearch::completionList(string s, QStringList& lst, int max)
// Complete last word in input by querying db for all possible terms.
void SSearch::completion()
{
LOGDEB(("SSearch::completion\n"));
LOGDEB("SSearch::completion\n" );
m_disableAutosearch = true;
m_stroketimeout->stop();
@ -506,7 +503,7 @@ void SSearch::completion()
return;
}
if (lst.size() >= maxdpy) {
LOGDEB0(("SSearch::completion(): truncating list\n"));
LOGDEB0("SSearch::completion(): truncating list\n" );
lst = lst.mid(0, maxdpy);
lst.append("[...]");
}
@ -542,7 +539,7 @@ void SSearch::completionTermChosen(const QString& text)
void SSearch::wrapupCompletion()
{
LOGDEB(("SSearch::wrapupCompletion\n"));
LOGDEB("SSearch::wrapupCompletion\n" );
queryText->clear();
queryText->addItems(prefs.ssearchHistory);
@ -707,9 +704,7 @@ bool SSearch::eventFilter(QObject *target, QEvent *event)
event->type() == QEvent::UpdateRequest ||
event->type() == QEvent::Paint)
return false;
LOGDEB2(("SSearch::eventFilter: target %p (%p) type %s\n",
target, queryText->lineEdit(),
eventTypeToStr(event->type())));
LOGDEB2("SSearch::eventFilter: target " << (target) << " (" << (queryText->lineEdit()) << ") type " << (eventTypeToStr(event->type())) << "\n" );
#endif
if (target == queryText->view()) {
@ -725,16 +720,15 @@ bool SSearch::eventFilter(QObject *target, QEvent *event)
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = (QKeyEvent *)event;
LOGDEB1(("SSearch::eventFilter: keyPress (m_escape %d) key %d\n",
m_escape, ke->key()));
LOGDEB1("SSearch::eventFilter: keyPress (m_escape " << (m_escape) << ") key " << (ke->key()) << "\n" );
if (ke->key() == Qt::Key_Escape) {
LOGDEB(("Escape\n"));
LOGDEB("Escape\n" );
m_escape = true;
m_disableAutosearch = true;
m_stroketimeout->stop();
return true;
} else if (m_escape && ke->key() == Qt::Key_Space) {
LOGDEB(("Escape space\n"));
LOGDEB("Escape space\n" );
ke->accept();
completion();
m_escape = false;
@ -750,11 +744,11 @@ bool SSearch::eventFilter(QObject *target, QEvent *event)
if (prefs.ssearchAsYouType) {
m_disableAutosearch = false;
QString qs = queryText->currentText();
LOGDEB0(("SSearch::eventFilter: start timer, qs [%s]\n",
qs2utf8s(qs).c_str()));
LOGDEB0("SSearch::eventFilter: start timer, qs [" << (qs2utf8s(qs)) << "]\n" );
m_stroketimeout->start(strokeTimeoutMS);
}
}
}
return false;
}

View file

@ -49,7 +49,7 @@
#include "pathut.h"
#include "uiprefs_w.h"
#include "viewaction_w.h"
#include "debuglog.h"
#include "log.h"
#include "editdialog.h"
#include "rclmain_w.h"
#include "ptrans_w.h"
@ -606,7 +606,7 @@ void UIPrefsDialog::addExtraDbPB_clicked()
}
}
LOGDEB(("ExtraDbDial: got: [%s]\n", dbdir.c_str()));
LOGDEB("ExtraDbDial: got: [" << (dbdir) << "]\n" );
path_catslash(dbdir);
bool stripped;
if (!Rcl::Db::testDbDir(dbdir, &stripped)) {
@ -642,3 +642,4 @@ void UIPrefsDialog::addExtraDbPB_clicked()
item->setCheckState(Qt::Checked);
idxLV->sortItems();
}

View file

@ -34,7 +34,7 @@ using namespace std;
#include <qlayout.h>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "viewaction_w.h"
@ -234,3 +234,4 @@ void ViewAction::editActions()
theconfig->setMimeViewerAllEx(s);
fillLists();
}

View file

@ -22,7 +22,7 @@
#include "ssearch_w.h"
#include "guiutils.h"
#include "debuglog.h"
#include "log.h"
#include "xmltosd.h"
#include "smallut.h"
#include "recoll.h"
@ -82,21 +82,13 @@ bool SDHXMLHandler::startElement(const QString & /* namespaceURI */,
const QString &qName,
const QXmlAttributes &attrs)
{
LOGDEB2(("SDHXMLHandler::startElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SDHXMLHandler::startElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
if (qName == "SD") {
// Advanced search history entries have no type. So we're good
// either if type is absent, or if it's searchdata
int idx = attrs.index("type");
if (idx >= 0 && attrs.value(idx).compare("searchdata")) {
LOGDEB(("XMLTOSD: bad type\n"))
return false;
}
resetTemps();
// A new search descriptor. Allocate data structure
sd = STD_SHARED_PTR<SearchData>(new SearchData);
if (!sd) {
LOGERR(("SDHXMLHandler::startElement: out of memory\n"));
LOGDEB("XMLTOSD: bad type\n" );
return false;
}
}
@ -107,8 +99,7 @@ bool SDHXMLHandler::endElement(const QString & /* namespaceURI */,
const QString & /* localName */,
const QString &qName)
{
LOGDEB2(("SDHXMLHandler::endElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SDHXMLHandler::endElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
if (qName == "CLT") {
if (currentText == "OR") {
@ -147,7 +138,7 @@ bool SDHXMLHandler::endElement(const QString & /* namespaceURI */,
c = new SearchDataClauseDist(SCLT_NEAR, text, slack, field);
c->setexclude(exclude);
} else {
LOGERR(("Bad clause type [%s]\n", qs2utf8s(whatclause).c_str()));
LOGERR("Bad clause type [" << (qs2utf8s(whatclause)) << "]\n" );
return false;
}
sd->addClause(c);
@ -219,8 +210,7 @@ STD_SHARED_PTR<Rcl::SearchData> xmlToSearchData(const string& xml)
xmlInputSource.setData(QString::fromUtf8(xml.c_str()));
if (!reader.parse(xmlInputSource) || !handler.isvalid) {
LOGERR(("xmlToSearchData: parse failed for [%s]\n",
xml.c_str()));
LOGERR("xmlToSearchData: parse failed for [" << (xml) << "]\n" );
return STD_SHARED_PTR<SearchData>();
}
return handler.sd;
@ -270,13 +260,12 @@ bool SSHXMLHandler::startElement(const QString & /* namespaceURI */,
const QString &qName,
const QXmlAttributes &attrs)
{
LOGDEB2(("SSHXMLHandler::startElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SSHXMLHandler::startElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
if (qName == "SD") {
// Simple search saved data has a type='ssearch' attribute.
int idx = attrs.index("type");
if (idx < 0 && attrs.value(idx).compare("ssearch")) {
LOGDEB(("XMLTOSSS: bad type\n"));
LOGDEB("XMLTOSSS: bad type\n" );
return false;
}
resetTemps();
@ -288,8 +277,7 @@ bool SSHXMLHandler::endElement(const QString & /* namespaceURI */,
const QString & /* localName */,
const QString &qName)
{
LOGDEB2(("SSHXMLHandler::endElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SSHXMLHandler::endElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
currentText = currentText.trimmed();
@ -309,7 +297,7 @@ bool SSHXMLHandler::endElement(const QString & /* namespaceURI */,
} else if (!currentText.compare("AND")) {
data.mode = SSearch::SST_ALL;
} else {
LOGERR(("BAD SEARCH MODE: [%s]\n", qs2utf8s(currentText).c_str()));
LOGERR("BAD SEARCH MODE: [" << (qs2utf8s(currentText)) << "]\n" );
return false;
}
} else if (qName == "AS") {
@ -336,10 +324,10 @@ bool xmlToSSearch(const string& xml, SSearchDef& data)
xmlInputSource.setData(QString::fromUtf8(xml.c_str()));
if (!reader.parse(xmlInputSource) || !handler.isvalid) {
LOGERR(("xmlToSSearch: parse failed for [%s]\n",
xml.c_str()));
LOGERR("xmlToSSearch: parse failed for [" << (xml) << "]\n" );
return false;
}
data = handler.data;
return true;
}

View file

@ -19,7 +19,7 @@
#include "docseq.h"
#include "filtseq.h"
#include "sortseq.h"
#include "debuglog.h"
#include "log.h"
#include "internfile.h"
PTMutexInit DocSequence::o_dblock;
@ -43,7 +43,7 @@ bool DocSequence::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
{
Rcl::Db *db = getDb();
if (db == 0) {
LOGERR(("DocSequence::getEnclosing: no db\n"));
LOGERR("DocSequence::getEnclosing: no db\n" );
return false;
}
PTMutexLocker locker(o_dblock);
@ -67,7 +67,7 @@ void DocSource::stripStack()
bool DocSource::buildStack()
{
LOGDEB2(("DocSource::buildStack()\n"));
LOGDEB2("DocSource::buildStack()\n" );
stripStack();
if (!m_seq)
@ -77,7 +77,7 @@ bool DocSource::buildStack()
// truncates the original list)
if (m_seq->canFilter()) {
if (!m_seq->setFiltSpec(m_fspec)) {
LOGERR(("DocSource::buildStack: setfiltspec failed\n"));
LOGERR("DocSource::buildStack: setfiltspec failed\n" );
}
} else {
if (m_fspec.isNotNull()) {
@ -88,7 +88,7 @@ bool DocSource::buildStack()
if (m_seq->canSort()) {
if (!m_seq->setSortSpec(m_sspec)) {
LOGERR(("DocSource::buildStack: setsortspec failed\n"));
LOGERR("DocSource::buildStack: setsortspec failed\n" );
}
} else {
if (m_sspec.isNotNull()) {
@ -114,7 +114,7 @@ string DocSource::title()
bool DocSource::setFiltSpec(const DocSeqFiltSpec &f)
{
LOGDEB2(("DocSource::setFiltSpec\n"));
LOGDEB2("DocSource::setFiltSpec\n" );
m_fspec = f;
buildStack();
return true;
@ -122,9 +122,10 @@ bool DocSource::setFiltSpec(const DocSeqFiltSpec &f)
bool DocSource::setSortSpec(const DocSeqSortSpec &s)
{
LOGDEB2(("DocSource::setSortSpec\n"));
LOGDEB2("DocSource::setSortSpec\n" );
m_sspec = s;
buildStack();
return true;
}

View file

@ -23,7 +23,7 @@
#include "docseqdb.h"
#include "rcldb.h"
#include "debuglog.h"
#include "log.h"
#include "wasatorcl.h"
using std::list;
@ -77,7 +77,7 @@ static const string cstr_mre("[...]");
// We ignore most abstract/snippets preferences.
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
{
LOGDEB(("DocSequenceDb::getAbstract/pair\n"));
LOGDEB("DocSequenceDb::getAbstract/pair\n" );
PTMutexLocker locker(o_dblock);
if (!setQuery())
return false;
@ -89,8 +89,7 @@ bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
ret = m_q->makeDocAbstract(doc, vpabs, maxoccs,
m_q->whatDb()->getAbsCtxLen()+ 2);
}
LOGDEB(("DocSequenceDb::getAbstract: got ret %d vpabs len %u\n", ret,
vpabs.size()));
LOGDEB("DocSequenceDb::getAbstract: got ret " << (ret) << " vpabs len " << (vpabs.size()) << "\n" );
if (vpabs.empty()) {
return true;
}
@ -161,7 +160,7 @@ string DocSequenceDb::title()
bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
{
LOGDEB(("DocSequenceDb::setFiltSpec\n"));
LOGDEB("DocSequenceDb::setFiltSpec\n" );
PTMutexLocker locker(o_dblock);
if (fs.isNotNull()) {
// We build a search spec by adding a filtering layer to the base one.
@ -209,8 +208,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
bool DocSequenceDb::setSortSpec(const DocSeqSortSpec &spec)
{
LOGDEB(("DocSequenceDb::setSortSpec: fld [%s] %s\n",
spec.field.c_str(), spec.desc ? "desc" : "asc"));
LOGDEB("DocSequenceDb::setSortSpec: fld [" << (spec.field) << "] " << (spec.desc ? "desc" : "asc") << "\n" );
PTMutexLocker locker(o_dblock);
if (spec.isNotNull()) {
m_q->setSortBy(spec.field, !spec.desc);
@ -233,8 +231,7 @@ bool DocSequenceDb::setQuery()
m_lastSQStatus = m_q->setQuery(m_fsdata);
if (!m_lastSQStatus) {
m_reason = m_q->getReason();
LOGERR(("DocSequenceDb::setQuery: rclquery::setQuery failed: %s\n",
m_reason.c_str()));
LOGERR("DocSequenceDb::setQuery: rclquery::setQuery failed: " << (m_reason) << "\n" );
}
return m_lastSQStatus;
}
@ -248,3 +245,4 @@ bool DocSequenceDb::docDups(const Rcl::Doc& doc, std::vector<Rcl::Doc>& dups)
return false;
}
}

View file

@ -26,7 +26,7 @@ using std::list;
#include "rcldb.h"
#include "fileudi.h"
#include "base64.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
// Encode document history entry:
@ -77,7 +77,7 @@ bool RclDHistoryEntry::decode(const string &value)
// Old style entry found, make an udi, using the fs udi maker
make_udi(fn, ipath, udi);
}
LOGDEB1(("RclDHistoryEntry::decode: udi [%s]\n", udi.c_str()));
LOGDEB1("RclDHistoryEntry::decode: udi [" << (udi) << "]\n" );
return true;
}
@ -89,8 +89,7 @@ bool RclDHistoryEntry::equal(const DynConfEntry& other)
bool historyEnterDoc(RclDynConf *dncf, const string& udi)
{
LOGDEB1(("historyEnterDoc: [%s] into %s\n",
udi.c_str(), dncf->getFilename().c_str()));
LOGDEB1("historyEnterDoc: [" << (udi) << "] into " << (dncf->getFilename()) << "\n" );
RclDHistoryEntry ne(time(0), udi);
RclDHistoryEntry scratch;
return dncf->insertNew(docHistSubKey, ne, scratch, 200);
@ -161,3 +160,4 @@ int DocSequenceHistory::getResCnt()
m_hlist = getDocHistory(m_hist);
return int(m_hlist.size());
}

View file

@ -23,7 +23,7 @@
#include "dynconf.h"
#include "base64.h"
#include "smallut.h"
#include "debuglog.h"
#include "log.h"
using namespace std;
@ -44,13 +44,13 @@ bool RclDynConf::insertNew(const string &sk, DynConfEntry &n, DynConfEntry &s,
for (it = names.begin(); it != names.end(); it++) {
string oval;
if (!m_data.get(*it, oval, sk)) {
LOGDEB(("No data for %s\n", (*it).c_str()));
LOGDEB("No data for " << ((*it)) << "\n" );
continue;
}
s.decode(oval);
if (s.equal(n)) {
LOGDEB(("Erasing old entry\n"));
LOGDEB("Erasing old entry\n" );
m_data.erase(*it, sk);
changed = true;
}
@ -80,9 +80,9 @@ bool RclDynConf::insertNew(const string &sk, DynConfEntry &n, DynConfEntry &s,
string value;
n.encode(value);
LOGDEB1(("Encoded value [%s] (%d)\n", value.c_str(), value.size()));
LOGDEB1("Encoded value [" << (value) << "] (" << (value.size()) << ")\n" );
if (!m_data.set(string(nname), value, sk)) {
LOGERR(("RclDHistory::insertNew: set failed\n"));
LOGERR("RclDHistory::insertNew: set failed\n" );
return false;
}
return true;
@ -124,7 +124,8 @@ list<string> RclDynConf::getStringList(const string sk)
#include <iostream>
#include "history.h"
#include "debuglog.h"
#include "log.h"
#ifndef NO_NAMESPACES
using namespace std;
@ -211,3 +212,4 @@ int main(int argc, char **argv)
}
#endif

View file

@ -15,7 +15,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "debuglog.h"
#include "log.h"
#include "filtseq.h"
#include "rclconfig.h"
@ -23,20 +23,19 @@ using std::string;
static bool filter(const DocSeqFiltSpec& fs, const Rcl::Doc *x)
{
LOGDEB2((" Filter: ncrits %d\n", fs.crits.size()));
LOGDEB2(" Filter: ncrits " << (fs.crits.size()) << "\n" );
// Compare using each criterion in term. We're doing an or:
// 1st ok ends
for (unsigned int i = 0; i < fs.crits.size(); i++) {
switch (fs.crits[i]) {
case DocSeqFiltSpec::DSFS_MIMETYPE:
LOGDEB2((" filter: MIMETYPE: me [%s] doc [%s]\n",
fs.values[i].c_str(), x->mimetype.c_str()));
LOGDEB2(" filter: MIMETYPE: me [" << (fs.values[i]) << "] doc [" << (x->mimetype) << "]\n" );
if (x->mimetype == fs.values[i])
return true;
break;
case DocSeqFiltSpec::DSFS_QLANG:
{
LOGDEB((" filter: QLANG [%s]!!\n", fs.values[i].c_str()));
LOGDEB(" filter: QLANG [" << (fs.values[i]) << "]!!\n" );
}
break;
case DocSeqFiltSpec::DSFS_PASSALL:
@ -56,7 +55,7 @@ DocSeqFiltered::DocSeqFiltered(RclConfig *conf, STD_SHARED_PTR<DocSequence> iseq
bool DocSeqFiltered::setFiltSpec(const DocSeqFiltSpec &filtspec)
{
LOGDEB0(("DocSeqFiltered::setFiltSpec\n"));
LOGDEB0("DocSeqFiltered::setFiltSpec\n" );
for (unsigned int i = 0; i < filtspec.crits.size(); i++) {
switch (filtspec.crits[i]) {
case DocSeqFiltSpec::DSFS_MIMETYPE:
@ -74,7 +73,7 @@ bool DocSeqFiltered::setFiltSpec(const DocSeqFiltSpec &filtspec)
m_config->getMimeCatTypes(catg, tps);
for (vector<string>::const_iterator it = tps.begin();
it != tps.end(); it++) {
LOGDEB2(("Adding mime: [%s]\n", it->c_str()));
LOGDEB2("Adding mime: [" << (it) << "]\n" );
m_spec.orCrit(DocSeqFiltSpec::DSFS_MIMETYPE, *it);
}
}
@ -94,7 +93,7 @@ bool DocSeqFiltered::setFiltSpec(const DocSeqFiltSpec &filtspec)
bool DocSeqFiltered::getDoc(int idx, Rcl::Doc &doc, string *)
{
LOGDEB2(("DocSeqFiltered::getDoc() fetching %d\n", idx));
LOGDEB2("DocSeqFiltered::getDoc() fetching " << (idx) << "\n" );
if (idx >= (int)m_dbindices.size()) {
// Have to fetch docs and filter until we get enough or
@ -122,3 +121,4 @@ bool DocSeqFiltered::getDoc(int idx, Rcl::Doc &doc, string *)
}
return true;
}

View file

@ -31,7 +31,7 @@ using std::set;
#include "rcldb.h"
#include "rclconfig.h"
#include "debuglog.h"
#include "log.h"
#include "textsplit.h"
#include "utf8iter.h"
#include "smallut.h"
@ -86,14 +86,12 @@ class TextSplitPTR : public TextSplit {
string dumb = term;
if (o_index_stripchars) {
if (!unacmaybefold(term, dumb, "UTF-8", UNACOP_UNACFOLD)) {
LOGINFO(("PlainToRich::takeword: unac failed for [%s]\n",
term.c_str()));
LOGINFO("PlainToRich::takeword: unac failed for [" << (term) << "]\n" );
return true;
}
}
//LOGDEB2(("Input dumbbed term: '%s' %d %d %d\n", dumb.c_str(),
// pos, bts, bte));
//LOGDEB2("Input dumbbed term: '" << (dumb) << "' " << (// pos) << " " << (bts) << " " << (bte) << "\n" );
// If this word is a search term, remember its byte-offset span.
map<string, size_t>::const_iterator it = m_terms.find(dumb);
@ -106,7 +104,7 @@ class TextSplitPTR : public TextSplit {
// Term group (phrase/near) handling
m_plists[dumb].push_back(pos);
m_gpostobytes[pos] = pair<int,int>(bts, bte);
//LOGDEB2(("Recorded bpos for %d: %d %d\n", pos, bts, bte));
//LOGDEB2("Recorded bpos for " << (pos) << ": " << (bts) << " " << (bte) << "\n" );
}
// Check for cancellation request
@ -169,8 +167,7 @@ static bool do_proximity_test(int window, vector<vector<int>* >& plists,
unsigned int i, int min, int max,
int *sp, int *ep, int minpos)
{
LOGDEB1(("do_prox_test: win %d i %d min %d max %d minpos %d\n",
window, i, min, max, minpos));
LOGDEB1("do_prox_test: win " << (window) << " i " << (i) << " min " << (min) << " max " << (max) << " minpos " << (minpos) << "\n" );
int tmp = max + 1 - window;
if (tmp < minpos)
tmp = minpos;
@ -207,8 +204,7 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx)
const vector<string>& terms = m_hdata.groups[grpidx];
int window = int(m_hdata.groups[grpidx].size() + m_hdata.slacks[grpidx]);
LOGDEB1(("TextSplitPTR::matchGroup:d %d: %s\n", window,
vecStringToString(terms).c_str()));
LOGDEB1("TextSplitPTR::matchGroup:d " << (window) << ": " << (vecStringToString(terms)) << "\n" );
// The position lists we are going to work with. We extract them from the
// (string->plist) map
@ -224,8 +220,7 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx)
it != terms.end(); it++) {
map<string, vector<int> >::iterator pl = m_plists.find(*it);
if (pl == m_plists.end()) {
LOGDEB1(("TextSplitPTR::matchGroup: [%s] not found in m_plists\n",
(*it).c_str()));
LOGDEB1("TextSplitPTR::matchGroup: [" << ((*it)) << "] not found in m_plists\n" );
return false;
}
plists.push_back(&(pl->second));
@ -234,7 +229,7 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx)
// I think this can't actually happen, was useful when we used to
// prune the groups, but doesn't hurt.
if (plists.size() < 2) {
LOGDEB1(("TextSplitPTR::matchGroup: no actual groups found\n"));
LOGDEB1("TextSplitPTR::matchGroup: no actual groups found\n" );
return false;
}
// Sort the positions lists so that the shorter is first
@ -245,11 +240,10 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx)
it = plistToTerm.find(plists[0]);
if (it == plistToTerm.end()) {
// SuperWeird
LOGERR(("matchGroup: term for first list not found !?!\n"));
LOGERR("matchGroup: term for first list not found !?!\n" );
return false;
}
LOGDEB1(("matchGroup: walking the shortest plist. Term [%s], len %d\n",
it->second.c_str(), plists[0]->size()));
LOGDEB1("matchGroup: walking the shortest plist. Term [" << (it->second) << "], len " << (plists[0]->size()) << "\n" );
}
// Minpos is the highest end of a found match. While looking for
@ -262,10 +256,9 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx)
it != plists[0]->end(); it++) {
int pos = *it;
int sta = INT_MAX, sto = 0;
LOGDEB2(("MatchGroup: Testing at pos %d\n", pos));
LOGDEB2("MatchGroup: Testing at pos " << (pos) << "\n" );
if (do_proximity_test(window,plists, 1, pos, pos, &sta, &sto, minpos)) {
LOGDEB1(("TextSplitPTR::matchGroup: MATCH termpos [%d,%d]\n",
sta, sto));
LOGDEB1("TextSplitPTR::matchGroup: MATCH termpos [" << (sta) << "," << (sto) << "]\n" );
// Maybe extend the window by 1st term position, this was not
// done by do_prox..
SETMINMAX(pos, sta, sto);
@ -274,15 +267,14 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx)
map<int, pair<int, int> >::iterator i1 = m_gpostobytes.find(sta);
map<int, pair<int, int> >::iterator i2 = m_gpostobytes.find(sto);
if (i1 != m_gpostobytes.end() && i2 != m_gpostobytes.end()) {
LOGDEB2(("TextSplitPTR::matchGroup: pushing bpos %d %d\n",
i1->second.first, i2->second.second));
LOGDEB2("TextSplitPTR::matchGroup: pushing bpos " << (i1->second.first) << " " << (i2->second.second) << "\n" );
tboffs.push_back(MatchEntry(i1->second.first,
i2->second.second, grpidx));
} else {
LOGDEB0(("matchGroup: no bpos found for %d or %d\n", sta, sto));
LOGDEB0("matchGroup: no bpos found for " << (sta) << " or " << (sto) << "\n" );
}
} else {
LOGDEB1(("matchGroup: no group match found at this position\n"));
LOGDEB1("matchGroup: no group match found at this position\n" );
}
}
@ -333,7 +325,7 @@ bool PlainToRich::plaintorich(const string& in,
{
Chrono chron;
bool ret = true;
LOGDEB1(("plaintorichich: in: [%s]\n", in.c_str()));
LOGDEB1("plaintorichich: in: [" << (in) << "]\n" );
m_hdata = &hdata;
// Compute the positions for the query terms. We use the text
@ -343,10 +335,10 @@ bool PlainToRich::plaintorich(const string& in,
// Note: the splitter returns the term locations in byte, not
// character, offsets.
splitter.text_to_words(in);
LOGDEB2(("plaintorich: split done %d mS\n", chron.millis()));
LOGDEB2("plaintorich: split done " << (chron.millis()) << " mS\n" );
// Compute the positions for NEAR and PHRASE groups.
splitter.matchGroups();
LOGDEB2(("plaintorich: group match done %d mS\n", chron.millis()));
LOGDEB2("plaintorich: group match done " << (chron.millis()) << " mS\n" );
out.clear();
out.push_back("");
@ -359,7 +351,7 @@ bool PlainToRich::plaintorich(const string& in,
// a term match when we are actually looking for a group match
// (the snippet generator does this...).
if (splitter.tboffs.empty()) {
LOGDEB1(("plaintorich: no term matches\n"));
LOGDEB1("plaintorich: no term matches\n" );
ret = false;
}
@ -372,7 +364,7 @@ bool PlainToRich::plaintorich(const string& in,
#if 0
for (vector<pair<int, int> >::const_iterator it = splitter.tboffs.begin();
it != splitter.tboffs.end(); it++) {
LOGDEB2(("plaintorich: region: %d %d\n", it->first, it->second));
LOGDEB2("plaintorich: region: " << (it->first) << " " << (it->second) << "\n" );
}
#endif
@ -532,6 +524,7 @@ bool PlainToRich::plaintorich(const string& in,
fclose(fp);
}
#endif
LOGDEB2(("plaintorich: done %d mS\n", chron.millis()));
LOGDEB2("plaintorich: done " << (chron.millis()) << " mS\n" );
return ret;
}

View file

@ -31,7 +31,7 @@
#include "rclconfig.h"
#include "pathut.h"
#include "rclinit.h"
#include "debuglog.h"
#include "log.h"
#include "wasatorcl.h"
#include "internfile.h"
#include "wipedir.h"
@ -427,3 +427,4 @@ endopts:
return 0;
}

View file

@ -31,7 +31,7 @@ using std::list;
#include "cstr.h"
#include "reslistpager.h"
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "smallut.h"
#include "rclutil.h"
@ -67,13 +67,12 @@ ResListPager::ResListPager(int pagesize)
void ResListPager::resultPageNext()
{
if (!m_docSource) {
LOGDEB(("ResListPager::resultPageNext: null source\n"));
LOGDEB("ResListPager::resultPageNext: null source\n" );
return;
}
int resCnt = m_docSource->getResCnt();
LOGDEB(("ResListPager::resultPageNext: rescnt %d, winfirst %d\n",
resCnt, m_winfirst));
LOGDEB("ResListPager::resultPageNext: rescnt " << (resCnt) << ", winfirst " << (m_winfirst) << "\n" );
if (m_winfirst < 0) {
m_winfirst = 0;
@ -125,13 +124,12 @@ static string maybeEscapeHtml(const string& fld)
void ResListPager::resultPageFor(int docnum)
{
if (!m_docSource) {
LOGDEB(("ResListPager::resultPageFor: null source\n"));
LOGDEB("ResListPager::resultPageFor: null source\n" );
return;
}
int resCnt = m_docSource->getResCnt();
LOGDEB(("ResListPager::resultPageFor(%d): rescnt %d, winfirst %d\n",
docnum, resCnt, m_winfirst));
LOGDEB("ResListPager::resultPageFor(" << (docnum) << "): rescnt " << (resCnt) << ", winfirst " << (m_winfirst) << "\n" );
m_winfirst = (docnum / m_pagesize) * m_pagesize;
// Get the next page of results.
@ -324,7 +322,7 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
// the table approach for 1.15 for now (in guiutils.cpp)
// chunk << "<br style='clear:both;height:0;line-height:0;'>" << endl;
LOGDEB2(("Chunk: [%s]\n", (const char *)chunk.rdbuf()->str().c_str()));
LOGDEB2("Chunk: [" << ((const char *)chunk.rdbuf()->str()) << "]\n" );
append(chunk.rdbuf()->str(), i, doc);
}
@ -340,13 +338,13 @@ bool ResListPager::getDoc(int num, Rcl::Doc& doc)
void ResListPager::displayPage(RclConfig *config)
{
LOGDEB(("ResListPager::displayPage\n"));
LOGDEB("ResListPager::displayPage\n" );
if (!m_docSource) {
LOGDEB(("ResListPager::displayPage: null source\n"));
LOGDEB("ResListPager::displayPage: null source\n" );
return;
}
if (m_winfirst < 0 && !pageEmpty()) {
LOGDEB(("ResListPager::displayPage: sequence error: winfirst < 0\n"));
LOGDEB("ResListPager::displayPage: sequence error: winfirst < 0\n" );
return;
}
@ -526,3 +524,4 @@ const string &ResListPager::dateFormat()
return cstr_format;
}

View file

@ -16,7 +16,7 @@
*/
#include <algorithm>
#include "debuglog.h"
#include "log.h"
#include "sortseq.h"
using std::string;
@ -30,7 +30,7 @@ public:
// behaves as operator<
int operator()(const Rcl::Doc *x, const Rcl::Doc *y)
{
LOGDEB1(("Comparing .. \n"));
LOGDEB1("Comparing .. \n" );
map<string,string>::const_iterator xit, yit;
xit = x->meta.find(ss.field);
@ -43,15 +43,15 @@ public:
bool DocSeqSorted::setSortSpec(const DocSeqSortSpec &sortspec)
{
LOGDEB(("DocSeqSorted::setSortSpec\n"));
LOGDEB("DocSeqSorted::setSortSpec\n" );
m_spec = sortspec;
int count = m_seq->getResCnt();
LOGDEB(("DocSeqSorted:: count %d\n", count));
LOGDEB("DocSeqSorted:: count " << (count) << "\n" );
m_docs.resize(count);
int i;
for (i = 0; i < count; i++) {
if (!m_seq->getDoc(i, m_docs[i])) {
LOGERR(("DocSeqSorted: getDoc failed for doc %d\n", i));
LOGERR("DocSeqSorted: getDoc failed for doc " << (i) << "\n" );
count = i;
break;
}
@ -68,9 +68,10 @@ bool DocSeqSorted::setSortSpec(const DocSeqSortSpec &sortspec)
bool DocSeqSorted::getDoc(int num, Rcl::Doc &doc, string *)
{
LOGDEB(("DocSeqSorted::getDoc(%d)\n", num));
LOGDEB("DocSeqSorted::getDoc(" << (num) << ")\n" );
if (num < 0 || num >= int(m_docsp.size()))
return false;
doc = *m_docsp[num];
return true;
}

View file

@ -21,7 +21,7 @@
#include "wasatorcl.h"
#include "wasaparserdriver.h"
#include "searchdata.h"
#include "debuglog.h"
#include "log.h"
#define YYDEBUG 1
@ -177,14 +177,12 @@ bool WasaParserDriver::addClause(SearchData *sd,
if (!fld.compare("date")) {
DateInterval di;
if (!parsedateinterval(cl->gettext(), &di)) {
LOGERR(("Bad date interval format: %s\n",
cl->gettext().c_str()));
LOGERR("Bad date interval format: " << (cl->gettext()) << "\n" );
m_reason = "Bad date interval format";
delete cl;
return false;
}
LOGDEB(("addClause:: date span: %d-%d-%d/%d-%d-%d\n",
di.y1,di.m1,di.d1, di.y2,di.m2,di.d2));
LOGDEB("addClause:: date span: " << (di.y1) << "-" << (di.m1) << "-" << (di.d1) << "/" << (di.y2) << "-" << (di.m2) << "-" << (di.d2) << "\n" );
m_haveDates = true;
m_dates = di;
delete cl;
@ -268,3 +266,4 @@ bool WasaParserDriver::addClause(SearchData *sd,
}
return sd->addClause(cl);
}

View file

@ -31,7 +31,7 @@ using namespace std;
#include <xapian.h>
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
namespace Rcl {
@ -124,3 +124,4 @@ Xapian::Query date_range_filter(int y1, int m1, int d1, int y2, int m2, int d2)
}

View file

@ -20,7 +20,7 @@
#include MEMORY_INCLUDE
#include "debuglog.h"
#include "log.h"
#include "utf8iter.h"
#include "smallut.h"
#include "chrono.h"
@ -41,8 +41,7 @@ namespace Rcl {
bool createExpansionDbs(Xapian::WritableDatabase& wdb,
const vector<string>& langs)
{
LOGDEB(("StemDb::createExpansionDbs: languages: %s\n",
stringsToString(langs).c_str()));
LOGDEB("StemDb::createExpansionDbs: languages: " << (stringsToString(langs)) << "\n" );
Chrono cron;
// Erase and recreate all the expansion groups
@ -102,7 +101,7 @@ bool createExpansionDbs(Xapian::WritableDatabase& wdb,
if (utfit.eof()) // Empty term?? Seems to happen.
continue;
if (TextSplit::isCJK(*utfit)) {
// LOGDEB(("stemskipped: Skipping CJK\n"));
// LOGDEB("stemskipped: Skipping CJK\n" );
continue;
}
@ -119,7 +118,7 @@ bool createExpansionDbs(Xapian::WritableDatabase& wdb,
// Dont' apply stemming to terms which don't look like
// natural language words.
if (!Db::isSpellingCandidate(*it)) {
LOGDEB1(("createExpansionDbs: skipped: [%s]\n", (*it).c_str()));
LOGDEB1("createExpansionDbs: skipped: [" << ((*it)) << "]\n" );
continue;
}
@ -145,12 +144,13 @@ bool createExpansionDbs(Xapian::WritableDatabase& wdb,
}
} XCATCHERROR(ermsg);
if (!ermsg.empty()) {
LOGERR(("Db::createStemDb: map build failed: %s\n", ermsg.c_str()));
LOGERR("Db::createStemDb: map build failed: " << (ermsg) << "\n" );
return false;
}
LOGDEB(("StemDb::createExpansionDbs: done: %.2f S\n", cron.secs()));
LOGDEB("StemDb::createExpansionDbs: done: " << (cron.secs()) << " S\n" );
return true;
}
}

View file

@ -20,7 +20,7 @@
#include <map>
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "rcldb_p.h"
#include "rclquery.h"
@ -50,7 +50,7 @@ static void listList(const string& what, const vector<string>&l)
for (vector<string>::const_iterator it = l.begin(); it != l.end(); it++) {
a = a + *it + " ";
}
LOGDEB(("%s: %s\n", what.c_str(), a.c_str()));
LOGDEB("" << (what) << ": " << (a) << "\n" );
}
#else
#define LOGABS LOGDEB2
@ -82,7 +82,7 @@ static void noPrefixList(const vector<string>& in, vector<string>& out)
bool Query::Native::getMatchTerms(unsigned long xdocid, vector<string>& terms)
{
if (!xenquire) {
LOGERR(("Query::getMatchTerms: no query opened\n"));
LOGERR("Query::getMatchTerms: no query opened\n" );
return false;
}
@ -95,7 +95,7 @@ bool Query::Native::getMatchTerms(unsigned long xdocid, vector<string>& terms)
xenquire->get_matching_terms_end(id)),
m_q->m_db->m_ndb->xrdb, m_q->m_reason);
if (!m_q->m_reason.empty()) {
LOGERR(("getMatchTerms: xapian error: %s\n", m_q->m_reason.c_str()));
LOGERR("getMatchTerms: xapian error: " << (m_q->m_reason) << "\n" );
return false;
}
noPrefixList(iterms, terms);
@ -178,7 +178,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
if (eit != hld.terms.end()) {
byRoot[eit->second].push_back(*qit);
} else {
LOGDEB0(("qualityTerms: [%s] not found in hld\n", (*qit).c_str()));
LOGDEB0("qualityTerms: [" << ((*qit)) << "] not found in hld\n" );
byRoot[*qit].push_back(*qit);
}
}
@ -257,7 +257,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
int Query::Native::getFirstMatchPage(Xapian::docid docid, string& term)
{
if (!m_q|| !m_q->m_db || !m_q->m_db->m_ndb || !m_q->m_db->m_ndb->m_isopen) {
LOGERR(("Query::getFirstMatchPage: no db\n"));
LOGERR("Query::getFirstMatchPage: no db\n" );
return -1;
}
Rcl::Db::Native *ndb(m_q->m_db->m_ndb);
@ -267,7 +267,7 @@ int Query::Native::getFirstMatchPage(Xapian::docid docid, string& term)
getMatchTerms(docid, terms);
if (terms.empty()) {
LOGDEB(("getFirstMatchPage: empty match term list (field match?)\n"));
LOGDEB("getFirstMatchPage: empty match term list (field match?)\n" );
return -1;
}
@ -322,7 +322,7 @@ int Query::Native::makeAbstract(Xapian::docid docid,
vector<string> matchedTerms;
getMatchTerms(docid, matchedTerms);
if (matchedTerms.empty()) {
LOGDEB(("makeAbstract::Empty term list\n"));
LOGDEB("makeAbstract::Empty term list\n" );
return ABSRES_ERROR;
}
@ -342,7 +342,7 @@ int Query::Native::makeAbstract(Xapian::docid docid,
LOGABS(("makeAbstract:%d: computed Qcoefs.\n", chron.ms()));
// This can't happen, but would crash us
if (totalweight == 0.0) {
LOGERR(("makeAbstract: totalweight == 0.0 !\n"));
LOGERR("makeAbstract: totalweight == 0.0 !\n" );
return ABSRES_ERROR;
}
@ -494,7 +494,7 @@ int Query::Native::makeAbstract(Xapian::docid docid,
// This can happen if there are term occurences in the keywords
// etc. but not elsewhere ?
if (totaloccs == 0) {
LOGDEB(("makeAbstract: no occurrences\n"));
LOGDEB("makeAbstract: no occurrences\n" );
return ABSRES_OK;
}
@ -513,8 +513,7 @@ int Query::Native::makeAbstract(Xapian::docid docid,
continue;
if (m_q->m_snipMaxPosWalk > 0 && cutoff-- < 0) {
ret |= ABSRES_TERMMISS;
LOGDEB0(("makeAbstract: max term count cutoff %d\n",
m_q->m_snipMaxPosWalk));
LOGDEB0("makeAbstract: max term count cutoff " << (m_q->m_snipMaxPosWalk) << "\n" );
break;
}
@ -524,8 +523,7 @@ int Query::Native::makeAbstract(Xapian::docid docid,
pos != xrdb.positionlist_end(docid, *term); pos++) {
if (m_q->m_snipMaxPosWalk > 0 && cutoff-- < 0) {
ret |= ABSRES_TERMMISS;
LOGDEB0(("makeAbstract: max term count cutoff %d\n",
m_q->m_snipMaxPosWalk));
LOGDEB0("makeAbstract: max term count cutoff " << (m_q->m_snipMaxPosWalk) << "\n" );
break;
}
// If we are beyond the max possible position, stop
@ -539,8 +537,7 @@ int Query::Native::makeAbstract(Xapian::docid docid,
// at the same position, we want to keep only the
// first one (ie: dockes and dockes@wanadoo.fr)
if (vit->second.empty()) {
LOGDEB2(("makeAbstract: populating: [%s] at %d\n",
(*term).c_str(), *pos));
LOGDEB2("makeAbstract: populating: [" << ((*term)) << "] at " << (*pos) << "\n" );
sparseDoc[*pos] = *term;
}
}
@ -557,11 +554,11 @@ int Query::Native::makeAbstract(Xapian::docid docid,
it++, ipos++) {
if (it->empty()) {
if (!epty)
LOGDEB(("makeAbstract:vec[%d]: [%s]\n", ipos, it->c_str()));
LOGDEB("makeAbstract:vec[" << (ipos) << "]: [" << (it) << "]\n" );
epty=true;
} else {
epty = false;
LOGDEB(("makeAbstract:vec[%d]: [%s]\n", ipos, it->c_str()));
LOGDEB("makeAbstract:vec[" << (ipos) << "]: [" << (it) << "]\n" );
}
}
#endif
@ -579,9 +576,9 @@ int Query::Native::makeAbstract(Xapian::docid docid,
string term;
for (map<unsigned int, string>::const_iterator it = sparseDoc.begin();
it != sparseDoc.end(); it++) {
LOGDEB2(("Abtract:output %u -> [%s]\n", it->first, it->second.c_str()));
LOGDEB2("Abtract:output " << (it->first) << " -> [" << (it->second) << "]\n" );
if (!occupiedmarker.compare(it->second)) {
LOGDEB(("Abstract: qtrm position not filled ??\n"));
LOGDEB("Abstract: qtrm position not filled ??\n" );
continue;
}
if (chunk.empty() && !vpbreaks.empty()) {
@ -611,9 +608,10 @@ int Query::Native::makeAbstract(Xapian::docid docid,
if (!chunk.empty())
vabs.push_back(Snippet(page, chunk).setTerm(term));
LOGDEB2(("makeAbtract: done in %d mS\n", chron.millis()));
LOGDEB2("makeAbtract: done in " << (chron.millis()) << " mS\n" );
return ret;
}
}

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,6 @@
#ifdef IDX_THREADS
#include "workqueue.h"
#endif // IDX_THREADS
#include "debuglog.h"
#include "xmacros.h"
#include "ptmutex.h"
@ -82,7 +81,6 @@ class Db::Native {
bool m_noversionwrite; //Set if open failed because of version mismatch!
#ifdef IDX_THREADS
WorkQueue<DbUpdTask*> m_wqueue;
int m_loglevel;
PTMutexInit m_mutex;
long long m_totalworkns;
bool m_havewriteq;

View file

@ -17,7 +17,7 @@
#include "autoconfig.h"
#include "rcldoc.h"
#include "debuglog.h"
#include "log.h"
#include "rclutil.h"
namespace Rcl {
@ -50,27 +50,26 @@ namespace Rcl {
void Doc::dump(bool dotext) const
{
LOGDEB(("Rcl::Doc::dump: url: [%s]\n", url.c_str()));
LOGDEB(("Rcl::Doc::dump: idxurl: [%s]\n", idxurl.c_str()));
LOGDEB(("Rcl::Doc::dump: ipath: [%s]\n", ipath.c_str()));
LOGDEB(("Rcl::Doc::dump: mimetype: [%s]\n", mimetype.c_str()));
LOGDEB(("Rcl::Doc::dump: fmtime: [%s]\n", fmtime.c_str()));
LOGDEB(("Rcl::Doc::dump: dmtime: [%s]\n", dmtime.c_str()));
LOGDEB(("Rcl::Doc::dump: origcharset: [%s]\n", origcharset.c_str()));
LOGDEB(("Rcl::Doc::dump: syntabs: [%d]\n", syntabs));
LOGDEB(("Rcl::Doc::dump: pcbytes: [%s]\n", pcbytes.c_str()));
LOGDEB(("Rcl::Doc::dump: fbytes: [%s]\n", fbytes.c_str()));
LOGDEB(("Rcl::Doc::dump: dbytes: [%s]\n", dbytes.c_str()));
LOGDEB(("Rcl::Doc::dump: sig: [%s]\n", sig.c_str()));
LOGDEB(("Rcl::Doc::dump: pc: [%d]\n", pc));
LOGDEB(("Rcl::Doc::dump: xdocid: [%lu]\n", (unsigned long)xdocid));
LOGDEB("Rcl::Doc::dump: url: [" << (url) << "]\n" );
LOGDEB("Rcl::Doc::dump: idxurl: [" << (idxurl) << "]\n" );
LOGDEB("Rcl::Doc::dump: ipath: [" << (ipath) << "]\n" );
LOGDEB("Rcl::Doc::dump: mimetype: [" << (mimetype) << "]\n" );
LOGDEB("Rcl::Doc::dump: fmtime: [" << (fmtime) << "]\n" );
LOGDEB("Rcl::Doc::dump: dmtime: [" << (dmtime) << "]\n" );
LOGDEB("Rcl::Doc::dump: origcharset: [" << (origcharset) << "]\n" );
LOGDEB("Rcl::Doc::dump: syntabs: [" << (syntabs) << "]\n" );
LOGDEB("Rcl::Doc::dump: pcbytes: [" << (pcbytes) << "]\n" );
LOGDEB("Rcl::Doc::dump: fbytes: [" << (fbytes) << "]\n" );
LOGDEB("Rcl::Doc::dump: dbytes: [" << (dbytes) << "]\n" );
LOGDEB("Rcl::Doc::dump: sig: [" << (sig) << "]\n" );
LOGDEB("Rcl::Doc::dump: pc: [" << (pc) << "]\n" );
LOGDEB("Rcl::Doc::dump: xdocid: [" << ((unsigned long)xdocid) << "]\n" );
for (map<string, string>::const_iterator it = meta.begin();
it != meta.end(); it++) {
LOGDEB(("Rcl::Doc::dump: meta[%s]: [%s]\n",
(*it).first.c_str(), (*it).second.c_str()));
LOGDEB("Rcl::Doc::dump: meta[" << ((*it).first) << "]: [" << ((*it).second) << "]\n" );
}
if (dotext)
LOGDEB(("Rcl::Doc::dump: text: \n[%s]\n", text.c_str()));
LOGDEB("Rcl::Doc::dump: text: \n[" << (text) << "]\n" );
}
// Copy ensuring no shared string data, for threading issues.
@ -100,3 +99,4 @@ namespace Rcl {
}
}

View file

@ -24,7 +24,7 @@ using namespace std;
#include <xapian.h>
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "rcldb_p.h"
#include "xmacros.h"
@ -39,11 +39,11 @@ namespace Rcl {
bool Db::docDups(const Doc& idoc, vector<Doc>& odocs)
{
if (m_ndb == 0) {
LOGERR(("Db::docDups: no db\n"));
LOGERR("Db::docDups: no db\n" );
return false;
}
if (idoc.xdocid == 0) {
LOGERR(("Db::docDups: null xdocid in input doc\n"));
LOGERR("Db::docDups: null xdocid in input doc\n" );
return false;
}
// Get the xapian doc
@ -51,7 +51,7 @@ bool Db::docDups(const Doc& idoc, vector<Doc>& odocs)
XAPTRY(xdoc = m_ndb->xrdb.get_document(Xapian::docid(idoc.xdocid)),
m_ndb->xrdb, m_reason);
if (!m_reason.empty()) {
LOGERR(("Db::docDups: xapian error: %s\n", m_reason.c_str()));
LOGERR("Db::docDups: xapian error: " << (m_reason) << "\n" );
return false;
}
@ -59,11 +59,11 @@ bool Db::docDups(const Doc& idoc, vector<Doc>& odocs)
string digest;
XAPTRY(digest = xdoc.get_value(VALUE_MD5), m_ndb->xrdb, m_reason);
if (!m_reason.empty()) {
LOGERR(("Db::docDups: xapian error: %s\n", m_reason.c_str()));
LOGERR("Db::docDups: xapian error: " << (m_reason) << "\n" );
return false;
}
if (digest.empty()) {
LOGDEB(("Db::docDups: doc has no md5\n"));
LOGDEB("Db::docDups: doc has no md5\n" );
return false;
}
string md5;
@ -79,14 +79,14 @@ bool Db::docDups(const Doc& idoc, vector<Doc>& odocs)
Query query(this);
query.setCollapseDuplicates(0);
if (!query.setQuery(sd)) {
LOGERR(("Db::docDups: setQuery failed\n"));
LOGERR("Db::docDups: setQuery failed\n" );
return false;
}
int cnt = query.getResCnt();
for (int i = 0; i < cnt; i++) {
Doc doc;
if (!query.getDoc(i, doc)) {
LOGERR(("Db::docDups: getDoc failed at %d (cnt %d)\n", i, cnt));
LOGERR("Db::docDups: getDoc failed at " << (i) << " (cnt " << (cnt) << ")\n" );
return false;
}
odocs.push_back(doc);
@ -98,18 +98,19 @@ bool Db::docDups(const Doc& idoc, vector<Doc>& odocs)
{
vector<Doc> dups;
bool ret;
LOGDEB(("DOCDUPS\n"));
LOGDEB("DOCDUPS\n" );
ret = m_db->docDups(doc, dups);
if (!ret) {
LOGDEB(("docDups failed\n"));
LOGDEB("docDups failed\n" );
} else if (dups.size() == 1) {
LOGDEB(("No dups\n"));
LOGDEB("No dups\n" );
} else {
for (unsigned int i = 0; i < dups.size(); i++) {
LOGDEB(("Dup: %s\n", dups[i].url.c_str()));
LOGDEB("Dup: " << (dups[i].url) << "\n" );
}
}
}
#endif
}

View file

@ -27,7 +27,7 @@
#include "cstr.h"
#include "rclconfig.h"
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "rcldb_p.h"
#include "rclquery.h"
@ -132,7 +132,7 @@ public:
sortterm = sortterm.substr(i1, sortterm.size()-i1);
}
LOGDEB2(("QSorter: [%s] -> [%s]\n", term.c_str(), sortterm.c_str()));
LOGDEB2("QSorter: [" << (term) << "] -> [" << (sortterm) << "]\n" );
return sortterm;
}
@ -166,8 +166,7 @@ void Query::setSortBy(const string& fld, bool ascending) {
m_sortField = m_db->getConf()->fieldQCanon(fld);
m_sortAscending = ascending;
}
LOGDEB0(("RclQuery::setSortBy: [%s] %s\n", m_sortField.c_str(),
m_sortAscending ? "ascending" : "descending"));
LOGDEB0("RclQuery::setSortBy: [" << (m_sortField) << "] " << (m_sortAscending ? "ascending" : "descending") << "\n" );
}
//#define ISNULL(X) (X).isNull()
@ -176,10 +175,10 @@ void Query::setSortBy(const string& fld, bool ascending) {
// Prepare query out of user search data
bool Query::setQuery(STD_SHARED_PTR<SearchData> sdata)
{
LOGDEB(("Query::setQuery:\n"));
LOGDEB("Query::setQuery:\n" );
if (!m_db || ISNULL(m_nq)) {
LOGERR(("Query::setQuery: not initialised!\n"));
LOGERR("Query::setQuery: not initialised!\n" );
return false;
}
m_resCnt = -1;
@ -233,7 +232,7 @@ bool Query::setQuery(STD_SHARED_PTR<SearchData> sdata)
}
if (!m_reason.empty()) {
LOGDEB(("Query::SetQuery: xapian error %s\n", m_reason.c_str()));
LOGDEB("Query::SetQuery: xapian error " << (m_reason) << "\n" );
return false;
}
@ -242,7 +241,7 @@ bool Query::setQuery(STD_SHARED_PTR<SearchData> sdata)
sdata->setDescription(d);
m_sd = sdata;
LOGDEB(("Query::SetQuery: Q: %s\n", sdata->getDescription().c_str()));
LOGDEB("Query::SetQuery: Q: " << (sdata->getDescription()) << "\n" );
return true;
}
@ -261,7 +260,7 @@ bool Query::getQueryTerms(vector<string>& terms)
}
} XCATCHERROR(ermsg);
if (!ermsg.empty()) {
LOGERR(("getQueryTerms: xapian error: %s\n", ermsg.c_str()));
LOGERR("getQueryTerms: xapian error: " << (ermsg) << "\n" );
return false;
}
return true;
@ -271,17 +270,16 @@ int Query::makeDocAbstract(const Doc &doc,
vector<Snippet>& abstract,
int maxoccs, int ctxwords)
{
LOGDEB(("makeDocAbstract: maxoccs %d ctxwords %d\n", maxoccs, ctxwords));
LOGDEB("makeDocAbstract: maxoccs " << (maxoccs) << " ctxwords " << (ctxwords) << "\n" );
if (!m_db || !m_db->m_ndb || !m_db->m_ndb->m_isopen || !m_nq) {
LOGERR(("Query::makeDocAbstract: no db or no nq\n"));
LOGERR("Query::makeDocAbstract: no db or no nq\n" );
return ABSRES_ERROR;
}
int ret = ABSRES_ERROR;
XAPTRY(ret = m_nq->makeAbstract(doc.xdocid, abstract, maxoccs, ctxwords),
m_db->m_ndb->xrdb, m_reason);
if (!m_reason.empty()) {
LOGDEB(("makeDocAbstract: makeAbstract error, reason: %s\n",
m_reason.c_str()));
LOGDEB("makeDocAbstract: makeAbstract error, reason: " << (m_reason) << "\n" );
return ABSRES_ERROR;
}
return ret;
@ -321,9 +319,9 @@ bool Query::makeDocAbstract(const Doc &doc, string& abstract)
int Query::getFirstMatchPage(const Doc &doc, string& term)
{
LOGDEB1(("Db::getFirstMatchPage\n"));;
LOGDEB1("Db::getFirstMatchPage\n" );;
if (!m_nq) {
LOGERR(("Query::getFirstMatchPage: no nq\n"));
LOGERR("Query::getFirstMatchPage: no nq\n" );
return false;
}
int pagenum = -1;
@ -341,7 +339,7 @@ static const int qquantum = 50;
int Query::getResCnt()
{
if (ISNULL(m_nq) || !m_nq->xenquire) {
LOGERR(("Query::getResCnt: no query opened\n"));
LOGERR("Query::getResCnt: no query opened\n" );
return -1;
}
if (m_resCnt >= 0)
@ -356,9 +354,9 @@ int Query::getResCnt()
m_resCnt = m_nq->xmset.get_matches_lower_bound(),
m_db->m_ndb->xrdb, m_reason);
LOGDEB(("Query::getResCnt: %d %d mS\n", m_resCnt, chron.millis()));
LOGDEB("Query::getResCnt: " << (m_resCnt) << " " << (chron.millis()) << " mS\n" );
if (!m_reason.empty())
LOGERR(("xenquire->get_mset: exception: %s\n", m_reason.c_str()));
LOGERR("xenquire->get_mset: exception: " << (m_reason) << "\n" );
} else {
m_resCnt = m_nq->xmset.get_matches_lower_bound();
}
@ -375,9 +373,9 @@ int Query::getResCnt()
// on subsequent calls is probably only due to disk caching.
bool Query::getDoc(int xapi, Doc &doc)
{
LOGDEB1(("Query::getDoc: xapian enquire index %d\n", xapi));
LOGDEB1("Query::getDoc: xapian enquire index " << (xapi) << "\n" );
if (ISNULL(m_nq) || !m_nq->xenquire) {
LOGERR(("Query::getDoc: no query opened\n"));
LOGERR("Query::getDoc: no query opened\n" );
return false;
}
@ -385,28 +383,24 @@ bool Query::getDoc(int xapi, Doc &doc)
int last = first + m_nq->xmset.size() -1;
if (!(xapi >= first && xapi <= last)) {
LOGDEB(("Fetching for first %d, count %d\n", xapi, qquantum));
LOGDEB("Fetching for first " << (xapi) << ", count " << (qquantum) << "\n" );
XAPTRY(m_nq->xmset = m_nq->xenquire->get_mset(xapi, qquantum,
(const Xapian::RSet *)0),
m_db->m_ndb->xrdb, m_reason);
if (!m_reason.empty()) {
LOGERR(("enquire->get_mset: exception: %s\n", m_reason.c_str()));
LOGERR("enquire->get_mset: exception: " << (m_reason) << "\n" );
return false;
}
if (m_nq->xmset.empty()) {
LOGDEB(("enquire->get_mset: got empty result\n"));
LOGDEB("enquire->get_mset: got empty result\n" );
return false;
}
first = m_nq->xmset.get_firstitem();
last = first + m_nq->xmset.size() -1;
}
LOGDEB1(("Query::getDoc: Qry [%s] win [%d-%d] Estimated results: %d",
m_nq->query.get_description().c_str(),
first, last, m_nq->xmset.get_matches_lower_bound()));
Xapian::Document xdoc;
Xapian::docid docid = 0;
int pc = 0;
@ -424,8 +418,7 @@ bool Query::getDoc(int xapi, Doc &doc)
m_reason.erase();
Chrono chron;
m_db->m_ndb->xdocToUdi(xdoc, udi);
LOGDEB2(("Query::getDoc: %d ms for udi [%s], collapse count %d\n",
chron.millis(), udi.c_str(), collapsecount));
LOGDEB2("Query::getDoc: " << (chron.millis()) << " ms for udi [" << (udi) << "], collapse count " << (collapsecount) << "\n" );
break;
} catch (Xapian::DatabaseModifiedError &error) {
// retry or end of loop
@ -436,7 +429,7 @@ bool Query::getDoc(int xapi, Doc &doc)
break;
}
if (!m_reason.empty()) {
LOGERR(("Query::getDoc: %s\n", m_reason.c_str()));
LOGERR("Query::getDoc: " << (m_reason) << "\n" );
return false;
}
doc.meta[Rcl::Doc::keyudi] = udi;
@ -461,10 +454,10 @@ bool Query::getDoc(int xapi, Doc &doc)
vector<string> Query::expand(const Doc &doc)
{
LOGDEB(("Rcl::Query::expand()\n"));
LOGDEB("Rcl::Query::expand()\n" );
vector<string> res;
if (ISNULL(m_nq) || !m_nq->xenquire) {
LOGERR(("Query::expand: no query opened\n"));
LOGERR("Query::expand: no query opened\n" );
return res;
}
@ -474,11 +467,11 @@ vector<string> Query::expand(const Doc &doc)
rset.add_document(Xapian::docid(doc.xdocid));
// We don't exclude the original query terms.
Xapian::ESet eset = m_nq->xenquire->get_eset(20, rset, false);
LOGDEB(("ESet terms:\n"));
LOGDEB("ESet terms:\n" );
// We filter out the special terms
for (Xapian::ESetIterator it = eset.begin();
it != eset.end(); it++) {
LOGDEB((" [%s]\n", (*it).c_str()));
LOGDEB(" [" << ((*it)) << "]\n" );
if ((*it).empty() || has_prefix(*it))
continue;
res.push_back(*it);
@ -496,7 +489,7 @@ vector<string> Query::expand(const Doc &doc)
}
if (!m_reason.empty()) {
LOGERR(("Query::expand: xapian error %s\n", m_reason.c_str()));
LOGERR("Query::expand: xapian error " << (m_reason) << "\n" );
res.clear();
}
@ -504,3 +497,4 @@ vector<string> Query::expand(const Doc &doc)
}
}

View file

@ -22,7 +22,7 @@
#include <string>
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "rcldb_p.h"
#include "stemdb.h"
@ -49,7 +49,7 @@ bool Db::filenameWildExp(const string& fnexp, vector<string>& names, int max)
pattern = "*" + pattern + "*";
} // else let it be
LOGDEB(("Rcl::Db::filenameWildExp: pattern: [%s]\n", pattern.c_str()));
LOGDEB("Rcl::Db::filenameWildExp: pattern: [" << (pattern) << "]\n" );
// We inconditionnally lowercase and strip the pattern, as is done
// during indexing. This seems to be the only sane possible
@ -79,12 +79,12 @@ bool Db::filenameWildExp(const string& fnexp, vector<string>& names, int max)
// Walk the Y terms and return min/max
bool Db::maxYearSpan(int *minyear, int *maxyear)
{
LOGDEB(("Rcl::Db:maxYearSpan\n"));
LOGDEB("Rcl::Db:maxYearSpan\n" );
*minyear = 1000000;
*maxyear = -1000000;
TermMatchResult result;
if (!idxTermMatch(ET_WILD, string(), "*", result, -1, "xapyear")) {
LOGINFO(("Rcl::Db:maxYearSpan: termMatch failed\n"));
LOGINFO("Rcl::Db:maxYearSpan: termMatch failed\n" );
return false;
}
for (vector<TermMatchEntry>::const_iterator it = result.entries.begin();
@ -165,11 +165,7 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
bool diac_sensitive = (typ_sens & ET_DIACSENS) != 0;
bool case_sensitive = (typ_sens & ET_CASESENS) != 0;
LOGDEB0(("Db::TermMatch: typ %s diacsens %d casesens %d lang [%s] term [%s]"
" max %d field [%s] stripped %d init res.size %u\n",
tmtptostr(matchtyp), diac_sensitive, case_sensitive, lang.c_str(),
_term.c_str(), max, field.c_str(), o_index_stripchars,
res.entries.size()));
LOGDEB0("Db::TermMatch: typ " << (tmtptostr(matchtyp)) << " diacsens " << (diac_sensitive) << " casesens " << (case_sensitive) << " lang [" << (lang) << "] term [" << (_term) << "] max " << (max) << " field [" << (field) << "] stripped " << (o_index_stripchars) << " init res.size " << (res.entries.size()) << "\n" );
// If index is stripped, no case or diac expansion can be needed:
// for the processing inside this routine, everything looks like
@ -179,7 +175,7 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
if (o_index_stripchars) {
diac_sensitive = case_sensitive = true;
if (!unacmaybefold(_term, term, "UTF-8", UNACOP_UNACFOLD)) {
LOGERR(("Db::termMatch: unac failed for [%s]\n", _term.c_str()));
LOGERR("Db::termMatch: unac failed for [" << (_term) << "]\n" );
return false;
}
}
@ -270,19 +266,17 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
exp1.swap(lexp);
sort(lexp.begin(), lexp.end());
lexp.erase(unique(lexp.begin(), lexp.end()), lexp.end());
LOGDEB(("ExpTerm: stemexp: %s\n",
stringsToString(lexp).c_str()));
LOGDEB("ExpTerm: stemexp: " << (stringsToString(lexp)) << "\n" );
}
if (m_syngroups.ok() && (typ_sens & ET_SYNEXP)) {
LOGDEB(("ExpTerm: got syngroups\n"));
LOGDEB("ExpTerm: got syngroups\n" );
vector<string> exp1(lexp);
for (vector<string>::const_iterator it = lexp.begin();
it != lexp.end(); it++) {
vector<string> sg = m_syngroups.getgroup(*it);
if (!sg.empty()) {
LOGDEB(("ExpTerm: syns: %s -> %s\n",
it->c_str(), stringsToString(sg).c_str()));
LOGDEB("ExpTerm: syns: " << *it << " -> " << (stringsToString(sg)) << "\n" );
for (vector<string>::const_iterator it1 = sg.begin();
it1 != sg.end(); it1++) {
if (it1->find_first_of(" ") != string::npos) {
@ -313,7 +307,7 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
}
// Filter the result and get the stats, possibly add prefixes.
LOGDEB(("ExpandTerm:TM: lexp: %s\n", stringsToString(lexp).c_str()));
LOGDEB("ExpandTerm:TM: lexp: " << (stringsToString(lexp)) << "\n" );
for (vector<string>::const_iterator it = lexp.begin();
it != lexp.end(); it++) {
idxTermMatch(Rcl::Db::ET_WILD, "", *it, res, max, field);
@ -341,13 +335,10 @@ bool Db::idxTermMatch(int typ_sens, const string &lang, const string &root,
TermMatchResult& res, int max, const string& field)
{
int typ = matchTypeTp(typ_sens);
LOGDEB1(("Db::idxTermMatch: typ %s lang [%s] term [%s] "
"max %d field [%s] init res.size %u\n",
tmtptostr(typ), lang.c_str(), root.c_str(),
max, field.c_str(), res.entries.size()));
LOGDEB1("Db::idxTermMatch: typ " << (tmtptostr(typ)) << " lang [" << (lang) << "] term [" << (root) << "] max " << (max) << " field [" << (field) << "] init res.size " << (res.entries.size()) << "\n" );
if (typ == ET_STEM) {
LOGFATAL(("RCLDB: internal error: idxTermMatch called with ET_STEM\n"));
LOGFATAL("RCLDB: internal error: idxTermMatch called with ET_STEM\n" );
abort();
}
@ -357,8 +348,7 @@ bool Db::idxTermMatch(int typ_sens, const string &lang, const string &root,
if (!field.empty()) {
const FieldTraits *ftp = 0;
if (!fieldToTraits(field, &ftp, true) || ftp->pfx.empty()) {
LOGDEB(("Db::termMatch: field is not indexed (no prefix): [%s]\n",
field.c_str()));
LOGDEB("Db::termMatch: field is not indexed (no prefix): [" << (field) << "]\n" );
} else {
prefix = wrap_prefix(ftp->pfx);
}
@ -369,8 +359,7 @@ bool Db::idxTermMatch(int typ_sens, const string &lang, const string &root,
if (typ == ET_REGEXP) {
matcher = STD_SHARED_PTR<StrMatcher>(new StrRegexpMatcher(root));
if (!matcher->ok()) {
LOGERR(("termMatch: regcomp failed: %s\n",
matcher->getreason().c_str()))
LOGERR("termMatch: regcomp failed: " << (matcher->getreason()));
return false;
}
} else if (typ == ET_WILD) {
@ -394,7 +383,7 @@ bool Db::idxTermMatch(int typ_sens, const string &lang, const string &root,
} else {
is = prefix + root.substr(0, es);
}
LOGDEB2(("termMatch: initsec: [%s]\n", is.c_str()));
LOGDEB2("termMatch: initsec: [" << (is) << "]\n" );
for (int tries = 0; tries < 2; tries++) {
try {
@ -446,7 +435,7 @@ bool Db::idxTermMatch(int typ_sens, const string &lang, const string &root,
break;
}
if (!m_reason.empty()) {
LOGERR(("termMatch: %s\n", m_reason.c_str()));
LOGERR("termMatch: " << (m_reason) << "\n" );
return false;
}
@ -468,7 +457,7 @@ TermIter *Db::termWalkOpen()
tit->db = m_ndb->xrdb;
XAPTRY(tit->it = tit->db.allterms_begin(), tit->db, m_reason);
if (!m_reason.empty()) {
LOGERR(("Db::termWalkOpen: xapian error: %s\n", m_reason.c_str()));
LOGERR("Db::termWalkOpen: xapian error: " << (m_reason) << "\n" );
return 0;
}
}
@ -484,7 +473,7 @@ bool Db::termWalkNext(TermIter *tit, string &term)
, tit->db, m_reason);
if (!m_reason.empty()) {
LOGERR(("Db::termWalkOpen: xapian error: %s\n", m_reason.c_str()));
LOGERR("Db::termWalkOpen: xapian error: " << (m_reason) << "\n" );
}
return false;
}
@ -504,7 +493,7 @@ bool Db::termExists(const string& word)
m_ndb->xrdb, m_reason);
if (!m_reason.empty()) {
LOGERR(("Db::termWalkOpen: xapian error: %s\n", m_reason.c_str()));
LOGERR("Db::termWalkOpen: xapian error: " << (m_reason) << "\n" );
return false;
}
return true;
@ -515,8 +504,7 @@ bool Db::stemDiffers(const string& lang, const string& word,
{
Xapian::Stem stemmer(lang);
if (!stemmer(word).compare(stemmer(base))) {
LOGDEB2(("Rcl::Db::stemDiffers: same for %s and %s\n",
word.c_str(), base.c_str()));
LOGDEB2("Rcl::Db::stemDiffers: same for " << (word) << " and " << (base) << "\n" );
return false;
}
return true;

View file

@ -34,7 +34,7 @@ using namespace std;
#include "rcldb.h"
#include "rcldb_p.h"
#include "searchdata.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "textsplit.h"
#include "unacpp.h"
@ -68,7 +68,7 @@ void SearchData::commoninit()
SearchData::~SearchData()
{
LOGDEB0(("SearchData::~SearchData\n"));
LOGDEB0("SearchData::~SearchData\n" );
for (qlist_it_t it = m_query.begin(); it != m_query.end(); it++)
delete *it;
}
@ -79,13 +79,13 @@ SearchData::~SearchData()
// We remove very common terms from the query to avoid performance issues.
bool SearchData::maybeAddAutoPhrase(Rcl::Db& db, double freqThreshold)
{
LOGDEB0(("SearchData::maybeAddAutoPhrase()\n"));
LOGDEB0("SearchData::maybeAddAutoPhrase()\n" );
// cerr << "BEFORE SIMPLIFY\n"; dump(cerr);
simplify();
// cerr << "AFTER SIMPLIFY\n"; dump(cerr);
if (!m_query.size()) {
LOGDEB2(("SearchData::maybeAddAutoPhrase: empty query\n"));
LOGDEB2("SearchData::maybeAddAutoPhrase: empty query\n" );
return false;
}
@ -96,27 +96,27 @@ bool SearchData::maybeAddAutoPhrase(Rcl::Db& db, double freqThreshold)
for (qlist_it_t it = m_query.begin(); it != m_query.end(); it++) {
SClType tp = (*it)->m_tp;
if (tp != SCLT_AND) {
LOGDEB2(("SearchData::maybeAddAutoPhrase: wrong tp %d\n", tp));
LOGDEB2("SearchData::maybeAddAutoPhrase: wrong tp " << (tp) << "\n" );
return false;
}
SearchDataClauseSimple *clp =
dynamic_cast<SearchDataClauseSimple*>(*it);
if (clp == 0) {
LOGDEB2(("SearchData::maybeAddAutoPhrase: dyncast failed\n"));
LOGDEB2("SearchData::maybeAddAutoPhrase: dyncast failed\n" );
return false;
}
if (it == m_query.begin()) {
field = clp->getfield();
} else {
if (clp->getfield().compare(field)) {
LOGDEB2(("SearchData::maybeAddAutoPhrase: diff. fields\n"));
LOGDEB2("SearchData::maybeAddAutoPhrase: diff. fields\n" );
return false;
}
}
// If there are wildcards or quotes in there, bail out
if (clp->gettext().find_first_of("\"*[?") != string::npos) {
LOGDEB2(("SearchData::maybeAddAutoPhrase: wildcards\n"));
LOGDEB2("SearchData::maybeAddAutoPhrase: wildcards\n" );
return false;
}
@ -145,8 +145,8 @@ bool SearchData::maybeAddAutoPhrase(Rcl::Db& db, double freqThreshold)
swords.append(1, ' ');
swords += *it;
} else {
LOGDEB0(("SearchData::Autophrase: [%s] too frequent (%.2f %%)\n",
it->c_str(), 100 * freq));
LOGDEB0("SearchData::Autophrase: [" << *it << "] too frequent ("
<< (100 * freq) << " %" << ")\n" );
slack++;
}
}
@ -154,7 +154,7 @@ bool SearchData::maybeAddAutoPhrase(Rcl::Db& db, double freqThreshold)
// We can't make a phrase with a single word :)
int nwords = TextSplit::countWords(swords);
if (nwords <= 1) {
LOGDEB2(("SearchData::maybeAddAutoPhrase: ended with 1 word\n"));
LOGDEB2("SearchData::maybeAddAutoPhrase: ended with 1 word\n" );
return false;
}
@ -171,7 +171,7 @@ bool SearchData::maybeAddAutoPhrase(Rcl::Db& db, double freqThreshold)
bool SearchData::addClause(SearchDataClause* cl)
{
if (m_tp == SCLT_OR && cl->getexclude()) {
LOGERR(("SearchData::addClause: cant add EXCL to OR list\n"));
LOGERR("SearchData::addClause: cant add EXCL to OR list\n" );
m_reason = "No Negative (AND_NOT) clauses allowed in OR queries";
return false;
}
@ -373,3 +373,4 @@ void SearchDataClauseSub::dump(ostream& o) const
}
} // Namespace Rcl

View file

@ -34,7 +34,7 @@ using namespace std;
#include "rcldb.h"
#include "rcldb_p.h"
#include "searchdata.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "textsplit.h"
#include "unacpp.h"
@ -62,7 +62,7 @@ bool SearchData::expandFileTypes(Db &db, vector<string>& tps)
{
const RclConfig *cfg = db.getConf();
if (!cfg) {
LOGFATAL(("Db::expandFileTypes: null configuration!!\n"));
LOGFATAL("Db::expandFileTypes: null configuration!!\n" );
return false;
}
vector<string> exptps;
@ -113,13 +113,12 @@ bool SearchData::clausesToQuery(Rcl::Db &db, SClType tp,
for (qlist_it_t it = query.begin(); it != query.end(); it++) {
Xapian::Query nq;
if (!(*it)->toNativeQuery(db, &nq)) {
LOGERR(("SearchData::clausesToQuery: toNativeQuery failed: %s\n",
(*it)->getReason().c_str()));
LOGERR("SearchData::clausesToQuery: toNativeQuery failed: " << ((*it)->getReason()) << "\n" );
reason += (*it)->getReason() + " ";
return false;
}
if (nq.empty()) {
LOGDEB(("SearchData::clausesToQuery: skipping empty clause\n"));
LOGDEB("SearchData::clausesToQuery: skipping empty clause\n" );
continue;
}
// If this structure is an AND list, must use AND_NOT for excl clauses.
@ -144,7 +143,7 @@ bool SearchData::clausesToQuery(Rcl::Db &db, SClType tp,
xq = Xapian::Query(op, xq, nq);
}
if (int(xq.get_length()) >= getMaxCl()) {
LOGERR(("%s\n", maxXapClauseMsg));
LOGERR("" << (maxXapClauseMsg) << "\n" );
m_reason += maxXapClauseMsg;
if (!o_index_stripchars)
m_reason += maxXapClauseCaseDiacMsg;
@ -152,7 +151,7 @@ bool SearchData::clausesToQuery(Rcl::Db &db, SClType tp,
}
}
LOGDEB0(("SearchData::clausesToQuery: got %d clauses\n", xq.get_length()));
LOGDEB0("SearchData::clausesToQuery: got " << (xq.get_length()) << " clauses\n" );
if (xq.empty())
xq = Xapian::Query::MatchAll;
@ -163,7 +162,7 @@ bool SearchData::clausesToQuery(Rcl::Db &db, SClType tp,
bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
{
LOGDEB(("SearchData::toNativeQuery: stemlang [%s]\n", m_stemlang.c_str()));
LOGDEB("SearchData::toNativeQuery: stemlang [" << (m_stemlang) << "]\n" );
m_reason.erase();
db.getConf()->getConfParam("maxTermExpand", &m_maxexp);
@ -175,8 +174,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
// Xapian query tree
Xapian::Query xq;
if (!clausesToQuery(db, m_tp, m_query, m_reason, &xq)) {
LOGERR(("SearchData::toNativeQuery: clausesToQuery failed. reason: %s\n",
m_reason.c_str()));
LOGERR("SearchData::toNativeQuery: clausesToQuery failed. reason: " << (m_reason) << "\n" );
return false;
}
@ -185,7 +183,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
if (m_dates.y1 == 0 || m_dates.y2 == 0) {
int minyear = 1970, maxyear = 2100;
if (!db.maxYearSpan(&minyear, &maxyear)) {
LOGERR(("Can't retrieve index min/max dates\n"));
LOGERR("Can't retrieve index min/max dates\n" );
//whatever, go on.
}
@ -200,18 +198,16 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
m_dates.d2 = 31;
}
}
LOGDEB(("Db::toNativeQuery: date interval: %d-%d-%d/%d-%d-%d\n",
m_dates.y1, m_dates.m1, m_dates.d1,
m_dates.y2, m_dates.m2, m_dates.d2));
LOGDEB("Db::toNativeQuery: date interval: " << (m_dates.y1) << "-" << (m_dates.m1) << "-" << (m_dates.d1) << "/" << (m_dates.y2) << "-" << (m_dates.m2) << "-" << (m_dates.d2) << "\n" );
Xapian::Query dq = date_range_filter(m_dates.y1, m_dates.m1, m_dates.d1,
m_dates.y2, m_dates.m2, m_dates.d2);
if (dq.empty()) {
LOGINFO(("Db::toNativeQuery: date filter is empty\n"));
LOGINFO("Db::toNativeQuery: date filter is empty\n" );
}
// If no probabilistic query is provided then promote the daterange
// filter to be THE query instead of filtering an empty query.
if (xq.empty()) {
LOGINFO(("Db::toNativeQuery: proba query is empty\n"));
LOGINFO("Db::toNativeQuery: proba query is empty\n" );
xq = dq;
} else {
xq = Xapian::Query(Xapian::Query::OP_FILTER, xq, dq);
@ -243,7 +239,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
// If no probabilistic query is provided then promote the
// filter to be THE query instead of filtering an empty query.
if (xq.empty()) {
LOGINFO(("Db::toNativeQuery: proba query is empty\n"));
LOGINFO("Db::toNativeQuery: proba query is empty\n" );
xq = sq;
} else {
xq = Xapian::Query(Xapian::Query::OP_FILTER, xq, sq);
@ -267,7 +263,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
for (vector<string>::iterator it = m_filetypes.begin();
it != m_filetypes.end(); it++) {
string term = wrap_prefix(mimetype_prefix) + *it;
LOGDEB0(("Adding file type term: [%s]\n", term.c_str()));
LOGDEB0("Adding file type term: [" << (term) << "]\n" );
tq = tq.empty() ? Xapian::Query(term) :
Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term));
}
@ -282,7 +278,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
for (vector<string>::iterator it = m_nfiletypes.begin();
it != m_nfiletypes.end(); it++) {
string term = wrap_prefix(mimetype_prefix) + *it;
LOGDEB0(("Adding negative file type term: [%s]\n", term.c_str()));
LOGDEB0("Adding negative file type term: [" << (term) << "]\n" );
tq = tq.empty() ? Xapian::Query(term) :
Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term));
}
@ -337,8 +333,7 @@ public:
if (m_lastpos < pos)
m_lastpos = pos;
bool noexpand = be ? m_ts->nostemexp() : true;
LOGDEB1(("TermProcQ::takeword: pushing [%s] pos %d noexp %d\n",
term.c_str(), pos, noexpand));
LOGDEB1("TermProcQ::takeword: pushing [" << (term) << "] pos " << (pos) << " noexp " << (noexpand) << "\n" );
if (m_terms[pos].size() < term.size()) {
m_terms[pos] = term;
m_nste[pos] = noexpand;
@ -401,8 +396,7 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
vector<string>* multiwords
)
{
LOGDEB0(("expandTerm: mods 0x%x fld [%s] trm [%s] lang [%s]\n",
mods, m_field.c_str(), term.c_str(), getStemLang().c_str()));
LOGDEB0("expandTerm: mods 0x" << (mods) << " fld [" << (m_field) << "] trm [" << (term) << "] lang [" << (getStemLang()) << "]\n" );
sterm.clear();
oexp.clear();
if (term.empty())
@ -426,7 +420,7 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
// No stem expansion if there are wildcards or if prevented by caller
bool nostemexp = (mods & SDCM_NOSTEMMING) != 0;
if (haswild || getStemLang().empty()) {
LOGDEB2(("expandTerm: found wildcards or stemlang empty: no exp\n"));
LOGDEB2("expandTerm: found wildcards or stemlang empty: no exp\n" );
nostemexp = true;
}
@ -448,7 +442,7 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
// performed (conversion+comparison) will automatically ignore
// accented characters which are actually a separate letter
if (getAutoDiac() && unachasaccents(term)) {
LOGDEB0(("expandTerm: term has accents -> diac-sensitive\n"));
LOGDEB0("expandTerm: term has accents -> diac-sensitive\n" );
diac_sensitive = true;
}
@ -459,14 +453,13 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
Utf8Iter it(term);
it++;
if (getAutoCase() && unachasuppercase(term.substr(it.getBpos()))) {
LOGDEB0(("expandTerm: term has uppercase -> case-sensitive\n"));
LOGDEB0("expandTerm: term has uppercase -> case-sensitive\n" );
case_sensitive = true;
}
// If we are sensitive to case or diacritics turn stemming off
if (diac_sensitive || case_sensitive) {
LOGDEB0(("expandTerm: diac or case sens set -> "
"stemexpand and synonyms off\n"));
LOGDEB0("expandTerm: diac or case sens set -> stemexpand and synonyms off\n" );
nostemexp = true;
synonyms = false;
}
@ -479,8 +472,7 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
if (noexpansion) {
oexp.push_back(prefix + term);
m_hldata.terms[term] = term;
LOGDEB(("ExpandTerm: noexpansion: final: %s\n",
stringsToString(oexp).c_str()));
LOGDEB("ExpandTerm: noexpansion: final: " << (stringsToString(oexp)) << "\n" );
return true;
}
@ -521,7 +513,7 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
it != oexp.end(); it++) {
m_hldata.terms[strip_prefix(*it)] = term;
}
LOGDEB(("ExpandTerm: final: %s\n", stringsToString(oexp).c_str()));
LOGDEB("ExpandTerm: final: " << (stringsToString(oexp)) << "\n" );
return true;
}
@ -572,8 +564,7 @@ processSimpleSpan(Rcl::Db &db, string& ermsg,
int mods, void * pq)
{
vector<Xapian::Query>& pqueries(*(vector<Xapian::Query>*)pq);
LOGDEB0(("StringToXapianQ::processSimpleSpan: [%s] mods 0x%x\n",
span.c_str(), (unsigned int)mods));
LOGDEB0("StringToXapianQ::processSimpleSpan: [" << (span) << "] mods 0x" << ((unsigned int)mods) << "\n" );
vector<string> exp;
string sterm; // dumb version of user term
@ -669,7 +660,7 @@ void SearchDataClauseSimple::processPhraseOrNear(Rcl::Db &db, string& ermsg,
vector<bool>::const_iterator nxit = splitData->nostemexps().begin();
for (vector<string>::const_iterator it = splitData->terms().begin();
it != splitData->terms().end(); it++, nxit++) {
LOGDEB0(("ProcessPhrase: processing [%s]\n", it->c_str()));
LOGDEB0("ProcessPhrase: processing [" << *it << "]\n" );
// Adjust when we do stem expansion. Not if disabled by
// caller, not inside phrases, and some versions of xapian
// will accept only one OR clause inside NEAR.
@ -685,8 +676,7 @@ void SearchDataClauseSimple::processPhraseOrNear(Rcl::Db &db, string& ermsg,
vector<string> exp;
if (!expandTerm(db, ermsg, lmods, *it, exp, sterm, prefix))
return;
LOGDEB0(("ProcessPhraseOrNear: exp size %d, exp: %s\n", exp.size(),
stringsToString(exp).c_str()));
LOGDEB0("ProcessPhraseOrNear: exp size " << (exp.size()) << ", exp: " << (stringsToString(exp)) << "\n" );
// groups is used for highlighting, we don't want prefixes in there.
vector<string> noprefs;
for (vector<string>::const_iterator it = exp.begin();
@ -712,8 +702,7 @@ void SearchDataClauseSimple::processPhraseOrNear(Rcl::Db &db, string& ermsg,
// Generate an appropriate PHRASE/NEAR query with adjusted slack
// For phrases, give a relevance boost like we do for original terms
LOGDEB2(("PHRASE/NEAR: alltermcount %d lastpos %d\n",
splitData->alltermcount(), splitData->lastpos()));
LOGDEB2("PHRASE/NEAR: alltermcount " << (splitData->alltermcount()) << " lastpos " << (splitData->lastpos()) << "\n" );
Xapian::Query xq(op, orqueries.begin(), orqueries.end(),
splitData->lastpos() + 1 + slack);
if (op == Xapian::Query::OP_PHRASE)
@ -783,9 +772,7 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq,
vector<Xapian::Query> &pqueries(*(vector<Xapian::Query>*)pq);
int mods = m_modifiers;
LOGDEB(("StringToXapianQ:pUS:: qstr [%s] fld [%s] mods 0x%x "
"slack %d near %d\n",
iq.c_str(), m_field.c_str(), mods, slack, useNear));
LOGDEB("StringToXapianQ:pUS:: qstr [" << (iq) << "] fld [" << (m_field) << "] mods 0x" << (mods) << " slack " << (slack) << " near " << (useNear) << "\n" );
ermsg.erase();
m_curcl = 0;
const StopList stops = db.getStopList();
@ -805,7 +792,7 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq,
try {
for (vector<string>::iterator it = phrases.begin();
it != phrases.end(); it++) {
LOGDEB0(("strToXapianQ: phrase/word: [%s]\n", it->c_str()));
LOGDEB0("strToXapianQ: phrase/word: [" << *it << "]\n" );
// Anchoring modifiers
int amods = stringToMods(*it);
int terminc = amods != 0 ? 1 : 0;
@ -843,7 +830,7 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq,
slack += tpq.lastpos() - int(tpq.terms().size()) + 1;
LOGDEB0(("strToXapianQ: termcount: %d\n", tpq.terms().size()));
LOGDEB0("strToXapianQ: termcount: " << (tpq.terms().size()) << "\n" );
switch (tpq.terms().size() + terminc) {
case 0:
continue;// ??
@ -878,7 +865,7 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq,
ermsg = "Caught unknown exception";
}
if (!ermsg.empty()) {
LOGERR(("stringToXapianQueries: %s\n", ermsg.c_str()));
LOGERR("stringToXapianQueries: " << (ermsg) << "\n" );
return false;
}
return true;
@ -887,9 +874,7 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq,
// Translate a simple OR or AND search clause.
bool SearchDataClauseSimple::toNativeQuery(Rcl::Db &db, void *p)
{
LOGDEB(("SearchDataClauseSimple::toNativeQuery: fld [%s] val [%s] "
"stemlang [%s]\n", m_field.c_str(), m_text.c_str(),
getStemLang().c_str()));
LOGDEB("SearchDataClauseSimple::toNativeQuery: fld [" << (m_field) << "] val [" << (m_text) << "] stemlang [" << (getStemLang()) << "]\n" );
Xapian::Query *qp = (Xapian::Query *)p;
*qp = Xapian::Query();
@ -899,7 +884,7 @@ bool SearchDataClauseSimple::toNativeQuery(Rcl::Db &db, void *p)
case SCLT_AND: op = Xapian::Query::OP_AND; break;
case SCLT_OR: op = Xapian::Query::OP_OR; break;
default:
LOGERR(("SearchDataClauseSimple: bad m_tp %d\n", m_tp));
LOGERR("SearchDataClauseSimple: bad m_tp " << (m_tp) << "\n" );
m_reason = "Internal error";
return false;
}
@ -908,7 +893,7 @@ bool SearchDataClauseSimple::toNativeQuery(Rcl::Db &db, void *p)
if (!processUserString(db, m_text, m_reason, &pqueries))
return false;
if (pqueries.empty()) {
LOGERR(("SearchDataClauseSimple: resolved to null query\n"));
LOGERR("SearchDataClauseSimple: resolved to null query\n" );
m_reason = string("Resolved to null query. Term too long ? : [" +
m_text + string("]"));
return false;
@ -952,12 +937,12 @@ bool SearchDataClauseFilename::toNativeQuery(Rcl::Db &db, void *p)
// Translate a dir: path filtering clause. See comments in .h
bool SearchDataClausePath::toNativeQuery(Rcl::Db &db, void *p)
{
LOGDEB(("SearchDataClausePath::toNativeQuery: [%s]\n", m_text.c_str()));
LOGDEB("SearchDataClausePath::toNativeQuery: [" << (m_text) << "]\n" );
Xapian::Query *qp = (Xapian::Query *)p;
*qp = Xapian::Query();
if (m_text.empty()) {
LOGERR(("SearchDataClausePath: empty path??\n"));
LOGERR("SearchDataClausePath: empty path??\n" );
m_reason = "Empty path ?";
return false;
}
@ -982,8 +967,7 @@ bool SearchDataClausePath::toNativeQuery(Rcl::Db &db, void *p)
*pit, exp, sterm, wrap_prefix(pathelt_prefix))) {
return false;
}
LOGDEB0(("SDataPath::toNative: exp size %d. Exp: %s\n", exp.size(),
stringsToString(exp).c_str()));
LOGDEB0("SDataPath::toNative: exp size " << (exp.size()) << ". Exp: " << (stringsToString(exp)) << "\n" );
if (exp.size() == 1)
orqueries.push_back(Xapian::Query(exp[0]));
else
@ -1006,7 +990,7 @@ bool SearchDataClausePath::toNativeQuery(Rcl::Db &db, void *p)
// Translate NEAR or PHRASE clause.
bool SearchDataClauseDist::toNativeQuery(Rcl::Db &db, void *p)
{
LOGDEB(("SearchDataClauseDist::toNativeQuery\n"));
LOGDEB("SearchDataClauseDist::toNativeQuery\n" );
Xapian::Query *qp = (Xapian::Query *)p;
*qp = Xapian::Query();
@ -1025,7 +1009,7 @@ bool SearchDataClauseDist::toNativeQuery(Rcl::Db &db, void *p)
if (!processUserString(db, s, m_reason, &pqueries, m_slack, useNear))
return false;
if (pqueries.empty()) {
LOGERR(("SearchDataClauseDist: resolved to null query\n"));
LOGERR("SearchDataClauseDist: resolved to null query\n" );
m_reason = string("Resolved to null query. Term too long ? : [" +
m_text + string("]"));
return false;
@ -1039,3 +1023,4 @@ bool SearchDataClauseDist::toNativeQuery(Rcl::Db &db, void *p)
}
} // Namespace Rcl

View file

@ -25,12 +25,13 @@
#include <string>
#include <vector>
#include <sstream>
using namespace std;
#include "searchdata.h"
#include "debuglog.h"
#include "log.h"
#include "base64.h"
using namespace std;
namespace Rcl {
static string tpToString(SClType tp)
@ -48,7 +49,7 @@ static string tpToString(SClType tp)
string SearchData::asXML()
{
LOGDEB(("SearchData::asXML\n"));
LOGDEB("SearchData::asXML\n" );
ostringstream os;
// Searchdata
@ -64,7 +65,7 @@ string SearchData::asXML()
for (unsigned int i = 0; i < m_query.size(); i++) {
SearchDataClause *c = m_query[i];
if (c->getTp() == SCLT_SUB) {
LOGERR(("SearchData::asXML: can't do subclauses !\n"));
LOGERR("SearchData::asXML: can't do subclauses !\n" );
continue;
}
if (c->getTp() == SCLT_PATH) {
@ -159,3 +160,4 @@ string SearchData::asXML()
}

View file

@ -33,7 +33,7 @@ using namespace std;
#include <xapian.h>
#include "stemdb.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "synfamily.h"
#include "unacpp.h"
@ -85,10 +85,10 @@ bool StemDb::stemExpand(const std::string& langs, const std::string& _term,
sort(result.begin(), result.end());
vector<string>::iterator uit = unique(result.begin(), result.end());
result.resize(uit - result.begin());
LOGDEB1(("stemExpand:%s: %s -> %s\n", langs.c_str(), term.c_str(),
stringsToString(result).c_str()));
LOGDEB1("stemExpand:" << (langs) << ": " << (term) << " -> " << (stringsToString(result)) << "\n" );
return true;
}
}

Some files were not shown because too many files have changed in this diff Show more