index: add recollindex -f option to ignore skippedPaths/Names when using recollindex -i. Allows arbitrary (non-recoll) path handling for skipped subtree
This commit is contained in:
parent
e29811cdb8
commit
478fb84ec4
@ -187,7 +187,7 @@ static bool matchesSkipped(const list<string>& tdl,
|
||||
/**
|
||||
* Index individual files, out of a full tree run. No database purging
|
||||
*/
|
||||
bool FsIndexer::indexFiles(list<string>& files)
|
||||
bool FsIndexer::indexFiles(list<string>& files, ConfIndexer::IxFlag flag)
|
||||
{
|
||||
if (!init())
|
||||
return false;
|
||||
@ -206,7 +206,8 @@ bool FsIndexer::indexFiles(list<string>& files)
|
||||
walker.setSkippedNames(m_config->getSkippedNames());
|
||||
|
||||
// Check path against indexed areas and skipped names/paths
|
||||
if (matchesSkipped(m_tdl, walker, *it)) {
|
||||
if (!(flag&ConfIndexer::IxFIgnoreSkip) &&
|
||||
matchesSkipped(m_tdl, walker, *it)) {
|
||||
it++; continue;
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
using std::list;
|
||||
#endif
|
||||
|
||||
#include "indexer.h"
|
||||
#include "fstreewalk.h"
|
||||
#include "rcldb.h"
|
||||
|
||||
@ -58,7 +59,8 @@ class FsIndexer : public FsTreeWalkerCB {
|
||||
bool index();
|
||||
|
||||
/** Index a list of files. No db cleaning or stemdb updating */
|
||||
bool indexFiles(list<string> &files);
|
||||
bool indexFiles(list<string> &files, ConfIndexer::IxFlag f =
|
||||
ConfIndexer::IxFNone);
|
||||
|
||||
/** Purge a list of files. */
|
||||
bool purgeFiles(list<string> &files);
|
||||
|
||||
@ -104,7 +104,7 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfIndexer::indexFiles(std::list<string>& ifiles)
|
||||
bool ConfIndexer::indexFiles(std::list<string>& ifiles, IxFlag flag)
|
||||
{
|
||||
list<string> myfiles;
|
||||
for (list<string>::const_iterator it = ifiles.begin();
|
||||
@ -123,7 +123,7 @@ bool ConfIndexer::indexFiles(std::list<string>& ifiles)
|
||||
if (!m_fsindexer)
|
||||
m_fsindexer = new FsIndexer(m_config, &m_db, m_updater);
|
||||
if (m_fsindexer)
|
||||
ret = m_fsindexer->indexFiles(myfiles);
|
||||
ret = m_fsindexer->indexFiles(myfiles, flag);
|
||||
LOGDEB2(("ConfIndexer::indexFiles: fsindexer returned %d, "
|
||||
"%d files remainining\n", ret, myfiles.size()));
|
||||
|
||||
|
||||
@ -73,6 +73,9 @@ class ConfIndexer {
|
||||
// Indexer types. Maybe we'll have something more dynamic one day
|
||||
enum ixType {IxTNone, IxTFs=1, IxTBeagleQueue=2,
|
||||
IxTAll = IxTFs | IxTBeagleQueue};
|
||||
// Misc indexing flags
|
||||
enum IxFlag {IxFNone = 0, IxFIgnoreSkip = 1};
|
||||
|
||||
/** Run indexers */
|
||||
bool index(bool resetbefore, ixType typestorun);
|
||||
|
||||
@ -91,7 +94,7 @@ class ConfIndexer {
|
||||
static list<string> getStemmerNames();
|
||||
|
||||
/** Index a list of files. No db cleaning or stemdb updating */
|
||||
bool indexFiles(std::list<string> &files);
|
||||
bool indexFiles(std::list<string> &files, IxFlag f = IxFNone);
|
||||
|
||||
/** Purge a list of files. */
|
||||
bool purgeFiles(std::list<string> &files);
|
||||
|
||||
@ -60,6 +60,7 @@ static int op_flags;
|
||||
#define OPT_x 0x800
|
||||
#define OPT_l 0x1000
|
||||
#define OPT_b 0x2000
|
||||
#define OPT_f 0x4000
|
||||
|
||||
// Globals for atexit cleanup
|
||||
static ConfIndexer *confindexer;
|
||||
@ -130,7 +131,9 @@ bool indexfiles(RclConfig *config, list<string> &filenames)
|
||||
return true;
|
||||
if (!makeIndexer(config))
|
||||
return false;
|
||||
return confindexer->indexFiles(filenames);
|
||||
return confindexer->indexFiles(filenames, (op_flags&OPT_f) ?
|
||||
ConfIndexer::IxFIgnoreSkip :
|
||||
ConfIndexer::IxFNone);
|
||||
}
|
||||
|
||||
// Delete a list of files. Same comments about call contexts as indexfiles.
|
||||
@ -185,8 +188,9 @@ static const char usage [] =
|
||||
#endif /* RCL_MONITOR */
|
||||
"recollindex -e <filename [filename ...]>\n"
|
||||
" Purge data for individual files. No stem database updates\n"
|
||||
"recollindex -i <filename [filename ...]>\n"
|
||||
"recollindex -i [-f] <filename [filename ...]>\n"
|
||||
" Index individual files. No database purge or stem database updates\n"
|
||||
" -f : ignore skippedPaths and skippedNames while doing this\n"
|
||||
"recollindex -l\n"
|
||||
" List available stemming languages\n"
|
||||
"recollindex -s <lang>\n"
|
||||
@ -244,6 +248,7 @@ int main(int argc, const char **argv)
|
||||
case 'D': op_flags |= OPT_D; break;
|
||||
#endif
|
||||
case 'e': op_flags |= OPT_e; break;
|
||||
case 'f': op_flags |= OPT_f; break;
|
||||
case 'h': op_flags |= OPT_h; break;
|
||||
case 'i': op_flags |= OPT_i; break;
|
||||
case 'l': op_flags |= OPT_l; break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user