diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index d67b8e8d..c7670f6f 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: indexer.cpp,v 1.49 2006-12-19 08:40:50 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: indexer.cpp,v 1.50 2006-12-21 09:22:31 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -82,6 +82,11 @@ bool DbIndexer::indexDb(bool resetbefore, list *topdirs) m_updater->status.dbtotdocs = m_db.docCnt(); } + // Always add dbdir and confdir to skipped paths. + m_walker.setSkippedPaths(list()); + m_walker.addSkippedPath(m_config->getConfDir()); + m_walker.addSkippedPath(m_dbdir); + for (list::const_iterator it = topdirs->begin(); it != topdirs->end(); it++) { LOGDEB(("DbIndexer::index: Indexing %s into %s\n", it->c_str(), diff --git a/src/index/rclmonrcv.cpp b/src/index/rclmonrcv.cpp index 8575f374..a3d8d810 100644 --- a/src/index/rclmonrcv.cpp +++ b/src/index/rclmonrcv.cpp @@ -1,7 +1,7 @@ #include "autoconfig.h" #ifdef RCL_MONITOR #ifndef lint -static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.8 2006-11-07 16:51:45 dockes Exp $ (C) 2006 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.9 2006-12-21 09:22:31 dockes Exp $ (C) 2006 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -128,11 +128,14 @@ void *rclMonRcvRun(void *q) // Walk the directory trees to add watches FsTreeWalker walker; + walker.addSkippedPath(queue->getConfig()->getConfDir()); WalkCB walkcb(queue->getConfig(), mon, queue); for (list::iterator it = tdl.begin(); it != tdl.end(); it++) { queue->getConfig()->setKeyDir(*it); - // Adjust the skipped names according to config + // Adjust the skipped names according to config, and add the dbdir to + // skipped paths walker.setSkippedNames(queue->getConfig()->getSkippedNames()); + walker.addSkippedPath(queue->getConfig()->getDbDir()); LOGDEB(("rclMonRcvRun: walking %s\n", it->c_str())); walker.walk(*it, walkcb); } diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index 57b76e3f..b6f6a0f1 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.28 2006-12-20 09:41:37 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.29 2006-12-21 09:22:31 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -216,6 +216,7 @@ static int op_flags; #define OPT_m 0x80 #define OPT_D 0x100 #define OPT_e 0x200 +#define OPT_w 0x400 static const char usage [] = "\n" @@ -253,6 +254,9 @@ Usage(void) int main(int argc, const char **argv) { string a_config; +#ifdef RCL_MONITOR + int sleepsecs = 60; +#endif thisprog = argv[0]; argc--; argv++; @@ -277,6 +281,12 @@ int main(int argc, const char **argv) case 's': op_flags |= OPT_s; break; #ifdef RCL_USE_ASPELL case 'S': op_flags |= OPT_S; break; +#endif +#ifdef RCL_MONITOR + case 'w': op_flags |= OPT_w; if (argc < 2) Usage(); + if ((sscanf(*(++argv), "%d", &sleepsecs)) != 1) + Usage(); + argc--; goto b1; #endif case 'z': op_flags |= OPT_z; break; default: Usage(); break; @@ -297,6 +307,7 @@ int main(int argc, const char **argv) cerr << "Configuration problem: " << reason << endl; exit(1); } + bool rezero(op_flags & OPT_z); if (op_flags & (OPT_i|OPT_e)) { list filenames; @@ -331,9 +342,16 @@ int main(int argc, const char **argv) if (argc != 0) Usage(); if (!(op_flags&OPT_D)) { - LOGDEB(("Daemonizing\n")); + LOGDEB(("recollindex: daemonizing\n")); daemon(0,0); } + if (sleepsecs > 0) { + LOGDEB(("recollindex: sleeping %d\n", sleepsecs)); + sleep(sleepsecs); + } + confindexer = new ConfIndexer(config, &updater); + confindexer->index(rezero); + delete confindexer; if (startMonitor(config, (op_flags&OPT_D)!=0)) exit(0); exit(1); @@ -350,7 +368,6 @@ int main(int argc, const char **argv) } else { confindexer = new ConfIndexer(config, &updater); - bool rezero(op_flags & OPT_z); exit(!confindexer->index(rezero)); } } diff --git a/src/sampleconf/mimemap b/src/sampleconf/mimemap index f00181ca..7e44f609 100644 --- a/src/sampleconf/mimemap +++ b/src/sampleconf/mimemap @@ -1,4 +1,4 @@ -# @(#$Id: mimemap,v 1.16 2006-09-05 09:52:23 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: mimemap,v 1.17 2006-12-21 09:22:31 dockes Exp $ (C) 2004 J.F.Dockes # Recoll: associations of file name extensions to mime types .txt = text/plain @@ -69,7 +69,7 @@ recoll_noindex = .tar.gz .tgz .tar.bz2 .tbz .log.gz .md5 .map \ .m4 .tcl .js .sh .pl .awk \ .o .lib .dll .a \ - .dat .bak .rdf .log .db .ini .msf \ + .dat .bak .rdf .log .db .ini .msf .pid \ .gnm .gnumeric .tex \ .gif .bmp .xpm \ ,v ~ # diff --git a/src/utils/fstreewalk.cpp b/src/utils/fstreewalk.cpp index 48b3f230..e88a3f8f 100644 --- a/src/utils/fstreewalk.cpp +++ b/src/utils/fstreewalk.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.9 2006-12-21 08:22:35 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.10 2006-12-21 09:22:31 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -77,18 +77,24 @@ int FsTreeWalker::getErrCnt() bool FsTreeWalker::addSkippedName(const string& pattern) { - data->skippedNames.push_back(pattern); + if (find(data->skippedNames.begin(), + data->skippedNames.end(), pattern) == data->skippedNames.end()) + data->skippedNames.push_back(pattern); return true; } bool FsTreeWalker::setSkippedNames(const list &patterns) { data->skippedNames = patterns; + data->skippedNames.sort(); + data->skippedNames.unique(); return true; } bool FsTreeWalker::addSkippedPath(const string& path) { - data->skippedPaths.push_back(path_canon(path)); + if (find(data->skippedPaths.begin(), + data->skippedPaths.end(), path) == data->skippedPaths.end()) + data->skippedPaths.push_back(path_canon(path)); return true; } bool FsTreeWalker::setSkippedPaths(const list &paths) @@ -97,6 +103,8 @@ bool FsTreeWalker::setSkippedPaths(const list &paths) for (list::iterator it = data->skippedPaths.begin(); it != data->skippedPaths.end(); it++) *it = path_canon(*it); + data->skippedPaths.sort(); + data->skippedPaths.unique(); return true; }