Added option -P to recollindex to force purge pass with -i

This commit is contained in:
Jean-Francois Dockes
2017-11-15 11:02:21 +01:00
parent b4f3cf35b0
commit 90dab89303
4 changed files with 53 additions and 52 deletions
+3
View File
@@ -211,6 +211,9 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
}
}
#endif
if (flag & IxFDoPurge) {
m_db.purge();
}
// The close would be done in our destructor, but we want status here
if (!m_db.close()) {
LOGERR("ConfIndexer::index: error closing database in " <<
+3
View File
@@ -107,6 +107,9 @@ class ConfIndexer {
IxFQuickShallow = 4,
// Do not retry files which previously failed ('+' sigs)
IxFNoRetryFailed = 8,
// Do perform purge pass even if we can't be sure we saw
// all files
IxFDoPurge = 16,
};
/** Run indexers */
+35 -26
View File
@@ -61,28 +61,31 @@ using namespace std;
// Command line options
static int op_flags;
#define OPT_MOINS 0x1
#define OPT_C 0x2
#define OPT_D 0x4
#define OPT_E 0x8
#define OPT_K 0x10
#define OPT_R 0x20
#define OPT_S 0x40
#define OPT_Z 0x80
#define OPT_b 0x100
#define OPT_c 0x200
#define OPT_e 0x400
#define OPT_f 0x800
#define OPT_h 0x1000
#define OPT_i 0x2000
#define OPT_k 0x4000
#define OPT_l 0x8000
#define OPT_m 0x10000
#define OPT_n 0x20000
#define OPT_r 0x40000
#define OPT_s 0x80000
#define OPT_w 0x100000
#define OPT_x 0x200000
#define OPT_z 0x400000
#define OPT_C 0x1
#define OPT_D 0x2
#define OPT_E 0x4
#define OPT_K 0x8
#define OPT_P 0x10
#define OPT_R 0x20
#define OPT_S 0x40
#define OPT_Z 0x80
#define OPT_b 0x100
#define OPT_c 0x200
#define OPT_e 0x400
#define OPT_f 0x800
#define OPT_h 0x1000
#define OPT_i 0x2000
#define OPT_k 0x4000
#define OPT_l 0x8000
#define OPT_m 0x10000
#define OPT_n 0x20000
#define OPT_p 0x40000
#define OPT_r 0x80000
#define OPT_s 0x100000
#define OPT_w 0x200000
#define OPT_x 0x400000
#define OPT_z 0x800000
ReExec *o_reexec;
// Globals for atexit cleanup
@@ -261,6 +264,9 @@ bool indexfiles(RclConfig *config, list<string> &filenames)
indexerFlags |= ConfIndexer::IxFNoRetryFailed;
if (op_flags & OPT_f)
indexerFlags |= ConfIndexer::IxFIgnoreSkip;
if (op_flags & OPT_P) {
indexerFlags |= ConfIndexer::IxFDoPurge;
}
return confindexer->indexFiles(filenames, indexerFlags);
}
@@ -351,10 +357,12 @@ static const char usage [] =
" -x disables exit on end of x11 session\n"
#endif /* DISABLE_X11MON */
#endif /* RCL_MONITOR */
"recollindex -e <filename [filename ...]>\n"
" Purge data for individual files. No stem database updates\n"
"recollindex -i [-f] [-Z] <filename [filename ...]>\n"
"recollindex -e [<filepath [path ...]>]\n"
" Purge data for individual files. No stem database updates.\n"
" Reads paths on stdin if none is given as argument.\n"
"recollindex -i [-f] [-Z] [<filepath [path ...]>]\n"
" Index individual files. No database purge or stem database updates\n"
" Will read paths on stdin if none is given as argument\n"
" -f : ignore skippedPaths and skippedNames while doing this\n"
"recollindex -r [-K] [-f] [-Z] [-p pattern] <top> \n"
" Recursive partial reindex. \n"
@@ -468,7 +476,8 @@ int main(int argc, char **argv)
case 'l': op_flags |= OPT_l; break;
case 'm': op_flags |= OPT_m; break;
case 'n': op_flags |= OPT_n; break;
case 'p': if (argc < 2) Usage();
case 'P': op_flags |= OPT_P; break;
case 'p': op_flags |= OPT_p; if (argc < 2) Usage();
selpatterns.push_back(*(++argv));
argc--; goto b1;
case 'r': op_flags |= OPT_r; break;