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

View File

@ -40,40 +40,25 @@ recollindex \- indexing command for the Recoll full text search system
.B \-n|-k
]
.br
.B recollindex
.B recollindex
[
.B \-c
<cd>
]
.B \-i
.B \-i
[
.B \-Z
]
[
.B \-k
]
[
.B \-f
.B \-Z \-k \-f \-P
]
[<path [path ...]>]
.br
.B recollindex
[
.B \-c
<configdir>
<cd>
]
.B \-r
[
.B \-Z
]
[
.B \-K
]
[
.B \-e
]
[
.B \-f
.B \-Z \-K \-e \-f
]
[
.B \-p
@ -121,8 +106,7 @@ pattern
.SH DESCRIPTION
The
.B recollindex
utility allows you to perform indexing operations for the Recoll text
search system.
command is the Recoll indexer.
.PP
As indexing can sometimes take a long time, the command can be interrupted
by sending an interrupt (Ctrl-C, SIGINT) or terminate (SIGTERM)
@ -207,12 +191,14 @@ configuration variables will be used, so that some files may be
skipped. You can tell recollindex to ignore skippedPaths and skippedNames
by setting the
.B
\-f
option. This allows fully custom file selection for a given subtree,
\-f option. This allows fully custom file selection for a given subtree,
for which you would add the top directory to skippedPaths, and use any
custom tool to generate the file list (ie: a tool from a source code
control system).
.PP
control system). When run this way, the indexer normally does not perform
the deleted files purge pass, because it cannot be sure to have seen all
the existing files. You can force a purge pass with
.B
\-P.
.PP
.B recollindex \-e
will erase data for individual files from the database. The stem expansion

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 " <<

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 */

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;