Switch to unified view

a/src/index/indexer.cpp b/src/index/indexer.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.15 2005-11-14 09:57:11 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.16 2005-11-21 14:31:24 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
#include <stdio.h>
4
#include <stdio.h>
5
#include <sys/stat.h>
5
#include <sys/stat.h>
6
#include <unistd.h>
6
#include <unistd.h>
7
7
...
...
213
     deleteZ(dbindexer);
213
     deleteZ(dbindexer);
214
}
214
}
215
215
216
bool ConfIndexer::index()
216
bool ConfIndexer::index()
217
{
217
{
218
    ConfTree *conf = config->getConfig();
219
220
    // Retrieve the list of directories to be indexed.
218
    // Retrieve the list of directories to be indexed.
221
    string topdirs;
219
    string topdirs;
222
    if (conf->get("topdirs", topdirs, "") == 0) {
220
    if (!config->getConfParam("topdirs", topdirs)) {
223
    LOGERR(("ConfIndexer::index: no top directories in configuration\n"));
221
    LOGERR(("ConfIndexer::index: no top directories in configuration\n"));
224
    return false;
222
    return false;
225
    }
223
    }
226
    list<string> tdl; // List of directories to be indexed
224
    list<string> tdl; // List of directories to be indexed
227
    if (!ConfTree::stringToStrings(topdirs, tdl)) {
225
    if (!ConfTree::stringToStrings(topdirs, tdl)) {
...
...
237
    map<string, list<string> > dbmap;
235
    map<string, list<string> > dbmap;
238
    map<string, list<string> >::iterator dbit;
236
    map<string, list<string> >::iterator dbit;
239
    for (dirit = tdl.begin(); dirit != tdl.end(); dirit++) {
237
    for (dirit = tdl.begin(); dirit != tdl.end(); dirit++) {
240
    string db;
238
    string db;
241
    string dir = path_tildexpand(*dirit);
239
    string dir = path_tildexpand(*dirit);
242
  if (conf->get("dbdir", db, dir) == 0) {
240
  config->setKeyDir(dir);
241
  if (!config->getConfParam("dbdir", db)) {
243
        LOGERR(("ConfIndexer::index: no database directory in "
242
        LOGERR(("ConfIndexer::index: no database directory in "
244
            "configuration for %s\n", dir.c_str()));
243
            "configuration for %s\n", dir.c_str()));
245
        return false;
244
        return false;
246
    }
245
    }
247
    db = path_tildexpand(db);
246
    db = path_tildexpand(db);
...
...
252
        dbmap[db] = l;
251
        dbmap[db] = l;
253
    } else {
252
    } else {
254
        dbit->second.push_back(dir);
253
        dbit->second.push_back(dir);
255
    }
254
    }
256
    }
255
    }
256
    config->setKeyDir("");
257
257
258
    // Index each directory group in turn
258
    // Index each directory group in turn
259
    for (dbit = dbmap.begin(); dbit != dbmap.end(); dbit++) {
259
    for (dbit = dbmap.begin(); dbit != dbmap.end(); dbit++) {
260
    //cout << dbit->first << " -> ";
260
    //cout << dbit->first << " -> ";
261
    //list<string>::const_iterator dit;
261
    //list<string>::const_iterator dit;