added recursive reindex option to recollindex command line
This commit is contained in:
parent
382963ee45
commit
60e8ce141c
2 changed files with 45 additions and 6 deletions
|
@ -14,7 +14,7 @@ QTGUI = @QTGUI@
|
||||||
|
|
||||||
all: mk/sysconf
|
all: mk/sysconf
|
||||||
${MAKE} -C lib
|
${MAKE} -C lib
|
||||||
${MAKE} -C index recollindex
|
${MAKE} -C index depend recollindex
|
||||||
@NOQTMAKE@(cd $(QTGUI); ${QMAKE} recoll.pro)
|
@NOQTMAKE@(cd $(QTGUI); ${QMAKE} recoll.pro)
|
||||||
@NOQTMAKE@${MAKE} -C $(QTGUI) depth=.. prefix=$(prefix) exec_prefix=$(exec_prefix) libdir=$(libdir)
|
@NOQTMAKE@${MAKE} -C $(QTGUI) depth=.. prefix=$(prefix) exec_prefix=$(exec_prefix) libdir=$(libdir)
|
||||||
@NOPYTHON@${MAKE} -C python/recoll libdir=$(libdir)
|
@NOPYTHON@${MAKE} -C python/recoll libdir=$(libdir)
|
||||||
|
|
|
@ -67,6 +67,7 @@ static int op_flags;
|
||||||
#define OPT_C 0x8000
|
#define OPT_C 0x8000
|
||||||
#define OPT_Z 0x10000
|
#define OPT_Z 0x10000
|
||||||
#define OPT_n 0x20000
|
#define OPT_n 0x20000
|
||||||
|
#define OPT_r 0x40000
|
||||||
|
|
||||||
ReExec *o_reexec;
|
ReExec *o_reexec;
|
||||||
|
|
||||||
|
@ -174,8 +175,35 @@ void rclIxIonice(const RclConfig *config)
|
||||||
rclionice(clss, classdata);
|
rclionice(clss, classdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index a list of files. We just check that they belong to one of the
|
class MakeListWalkerCB : public FsTreeWalkerCB {
|
||||||
// topdirs subtrees, and call the indexer method.
|
public:
|
||||||
|
MakeListWalkerCB(list<string>& files)
|
||||||
|
: m_files(files)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual FsTreeWalker::Status
|
||||||
|
processone(const string & fn, const struct stat *, FsTreeWalker::CbFlag flg)
|
||||||
|
{
|
||||||
|
if (flg == FsTreeWalker::FtwDirEnter || flg == FsTreeWalker::FtwRegular)
|
||||||
|
m_files.push_back(fn);
|
||||||
|
return FsTreeWalker::FtwOk;
|
||||||
|
}
|
||||||
|
list<string>& m_files;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Build a list of things to index and call indexfiles.
|
||||||
|
bool recursive_index(RclConfig *config, const string& top)
|
||||||
|
{
|
||||||
|
list<string> files;
|
||||||
|
MakeListWalkerCB cb(files);
|
||||||
|
FsTreeWalker walker;
|
||||||
|
walker.walk(top, cb);
|
||||||
|
return indexfiles(config, files);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Index a list of files. We just call the top indexer method, which
|
||||||
|
// will sort out what belongs to the indexed trees and call the
|
||||||
|
// appropriate indexers.
|
||||||
//
|
//
|
||||||
// This is called either from the command line or from the monitor. In
|
// This is called either from the command line or from the monitor. In
|
||||||
// this case we're called repeatedly in the same process, and the
|
// this case we're called repeatedly in the same process, and the
|
||||||
|
@ -231,7 +259,7 @@ static const char usage [] =
|
||||||
" Index everything according to configuration file\n"
|
" Index everything according to configuration file\n"
|
||||||
" -z : reset database before starting indexing\n"
|
" -z : reset database before starting indexing\n"
|
||||||
" -Z : in place reset: consider all documents as changed. Can also\n"
|
" -Z : in place reset: consider all documents as changed. Can also\n"
|
||||||
" be combined with -i but not -m\n"
|
" be combined with -i or -r but not -m\n"
|
||||||
#ifdef RCL_MONITOR
|
#ifdef RCL_MONITOR
|
||||||
"recollindex -m [-w <secs>] -x [-D] [-C]\n"
|
"recollindex -m [-w <secs>] -x [-D] [-C]\n"
|
||||||
" Perform real time indexing. Don't become a daemon if -D is set.\n"
|
" Perform real time indexing. Don't become a daemon if -D is set.\n"
|
||||||
|
@ -244,9 +272,11 @@ static const char usage [] =
|
||||||
#endif /* RCL_MONITOR */
|
#endif /* RCL_MONITOR */
|
||||||
"recollindex -e <filename [filename ...]>\n"
|
"recollindex -e <filename [filename ...]>\n"
|
||||||
" Purge data for individual files. No stem database updates\n"
|
" Purge data for individual files. No stem database updates\n"
|
||||||
"recollindex -i [-f] <filename [filename ...]>\n"
|
"recollindex -i [-f] [-Z] <filename [filename ...]>\n"
|
||||||
" Index individual files. No database purge or stem database updates\n"
|
" Index individual files. No database purge or stem database updates\n"
|
||||||
" -f : ignore skippedPaths and skippedNames while doing this\n"
|
" -f : ignore skippedPaths and skippedNames while doing this\n"
|
||||||
|
"recollindex -r [-f] [-Z] <top> \n"
|
||||||
|
" Recursive partial reindex\n"
|
||||||
"recollindex -l\n"
|
"recollindex -l\n"
|
||||||
" List available stemming languages\n"
|
" List available stemming languages\n"
|
||||||
"recollindex -s <lang>\n"
|
"recollindex -s <lang>\n"
|
||||||
|
@ -324,6 +354,7 @@ int main(int argc, char **argv)
|
||||||
case 'l': op_flags |= OPT_l; break;
|
case 'l': op_flags |= OPT_l; break;
|
||||||
case 'm': op_flags |= OPT_m; break;
|
case 'm': op_flags |= OPT_m; break;
|
||||||
case 'n': op_flags |= OPT_n; break;
|
case 'n': op_flags |= OPT_n; break;
|
||||||
|
case 'r': op_flags |= OPT_r; break;
|
||||||
case 's': op_flags |= OPT_s; break;
|
case 's': op_flags |= OPT_s; break;
|
||||||
#ifdef RCL_USE_ASPELL
|
#ifdef RCL_USE_ASPELL
|
||||||
case 'S': op_flags |= OPT_S; break;
|
case 'S': op_flags |= OPT_S; break;
|
||||||
|
@ -349,7 +380,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((op_flags & OPT_z) && (op_flags & (OPT_i|OPT_e)))
|
if ((op_flags & OPT_z) && (op_flags & (OPT_i|OPT_e|OPT_r)))
|
||||||
Usage();
|
Usage();
|
||||||
if ((op_flags & OPT_Z) && (op_flags & (OPT_m)))
|
if ((op_flags & OPT_Z) && (op_flags & (OPT_m)))
|
||||||
Usage();
|
Usage();
|
||||||
|
@ -423,6 +454,14 @@ int main(int argc, char **argv)
|
||||||
if (confindexer && !confindexer->getReason().empty())
|
if (confindexer && !confindexer->getReason().empty())
|
||||||
cerr << confindexer->getReason() << endl;
|
cerr << confindexer->getReason() << endl;
|
||||||
exit(status ? 0 : 1);
|
exit(status ? 0 : 1);
|
||||||
|
} else if (op_flags & OPT_r) {
|
||||||
|
if (argc != 1)
|
||||||
|
Usage();
|
||||||
|
string top = *argv++; argc--;
|
||||||
|
bool status = recursive_index(config, top);
|
||||||
|
if (confindexer && !confindexer->getReason().empty())
|
||||||
|
cerr << confindexer->getReason() << endl;
|
||||||
|
exit(status ? 0 : 1);
|
||||||
} else if (op_flags & OPT_l) {
|
} else if (op_flags & OPT_l) {
|
||||||
if (argc != 0)
|
if (argc != 0)
|
||||||
Usage();
|
Usage();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue