add followLinks option

This commit is contained in:
dockes 2007-08-30 09:01:52 +00:00
parent 055b6566cc
commit 5a3244a5a8
7 changed files with 45 additions and 10 deletions

View File

@ -24,7 +24,7 @@
Dockes</holder>
</copyright>
<releaseinfo>$Id: usermanual.sgml,v 1.49 2007-08-30 08:39:04 dockes Exp $</releaseinfo>
<releaseinfo>$Id: usermanual.sgml,v 1.50 2007-08-30 09:00:22 dockes Exp $</releaseinfo>
<abstract>
<para>This document introduces full text search notions
@ -1845,7 +1845,10 @@ skippedPaths = ~/somedir/*.txt
symbolic links while walking the file tree. The default is
to ignore symbolic links to avoid multiple indexing of
linked files. No effort is made to avoid duplication when
this option is set to true..</para>
this option is set to true. This option can be set
individually for each of the <literal>topdirs</literal>
members by using sections. It can not be changed below the
<literal>topdirs</literal> level.</para>
</listitem>
</varlistentry>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.61 2007-08-28 08:12:58 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.62 2007-08-30 09:01:52 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -97,6 +97,15 @@ bool DbIndexer::indexDb(bool resetbefore, list<string> *topdirs)
// Set the current directory in config so that subsequent
// getConfParams() will get local values
m_config->setKeyDir(*it);
// Adjust the "follow symlinks" option
bool follow;
if (m_config->getConfParam("followLinks", &follow) && follow) {
m_walker.setOpts(FsTreeWalker::FtwFollow);
} else {
m_walker.setOpts(FsTreeWalker::FtwOptNone);
}
int abslen;
if (m_config->getConfParam("idxabsmlen", &abslen))
m_db.setAbstractParams(abslen, -1, -1);

View File

@ -16,7 +16,7 @@
*/
#ifndef _INDEXER_H_INCLUDED_
#define _INDEXER_H_INCLUDED_
/* @(#$Id: indexer.h,v 1.24 2007-07-10 09:23:28 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: indexer.h,v 1.25 2007-08-30 09:01:52 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
@ -96,8 +96,8 @@ class DbIndexer : public FsTreeWalkerCB {
const string &dbd, // Place where the db lives
DbIxStatusUpdater *updfunc = 0 // status updater callback
)
: m_config(cnf), m_dbdir(dbd), m_updater(updfunc) {
}
: m_config(cnf), m_dbdir(dbd), m_updater(updfunc)
{}
virtual ~DbIndexer();

View File

@ -1,7 +1,7 @@
#include "autoconfig.h"
#ifdef RCL_MONITOR
#ifndef lint
static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.12 2007-07-12 10:53:07 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.13 2007-08-30 09:01:52 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -134,6 +134,14 @@ void *rclMonRcvRun(void *q)
WalkCB walkcb(queue->getConfig(), mon, queue);
for (list<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
queue->getConfig()->setKeyDir(*it);
// Adjust the follow symlinks options
bool follow;
if (queue->getConfig()->getConfParam("followLinks", &follow) &&
follow) {
walker.setOpts(FsTreeWalker::FtwFollow);
} else {
walker.setOpts(FsTreeWalker::FtwOptNone);
}
// Adjust the skipped names according to config
walker.setSkippedNames(queue->getConfig()->getSkippedNames());
// Add the dbdir to skipped paths. Note that adding the dbdir

View File

@ -1,4 +1,4 @@
# @(#$Id: recoll.conf.in,v 1.20 2007-08-26 13:34:06 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: recoll.conf.in,v 1.21 2007-08-30 09:01:52 dockes Exp $ (C) 2004 J.F.Dockes
#
# Recoll default configuration file. This typically lives in
# @prefix@/share/recoll/examples and provides default values. You can
@ -24,6 +24,11 @@ skippedNames = #* bin CVS Cache cache* caughtspam tmp .thumbnails .svn \
# not set, the daemon uses skippedPaths.
#daemSkippedPaths =
# Option to follow symbolic links. We normally don't, to avoid duplicated
# indexing (in any case, no effort is made to identify or avoid multiple
# indexing of linked files)
# followLinks = 0
# Debug messages. 3 is errors/warnings only. 4 would be quite verbose.
loglevel = 3
logfilename = stderr

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.13 2007-08-28 08:08:38 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.14 2007-08-30 09:01:52 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -65,6 +65,13 @@ FsTreeWalker::~FsTreeWalker()
delete data;
}
void FsTreeWalker::setOpts(Options opts)
{
if (data) {
data->options = opts;
}
}
string FsTreeWalker::getReason()
{
return data->reason.str();

View File

@ -16,7 +16,7 @@
*/
#ifndef _FSTREEWALK_H_INCLUDED_
#define _FSTREEWALK_H_INCLUDED_
/* @(#$Id: fstreewalk.h,v 1.8 2007-08-28 08:08:39 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: fstreewalk.h,v 1.9 2007-08-30 09:01:52 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
@ -46,6 +46,9 @@ class FsTreeWalker {
FsTreeWalker(Options opts = FtwOptNone);
~FsTreeWalker();
void setOpts(Options opts);
/**
* Begin file system walk.
* @param dir is not checked against the ignored patterns (this is