ensure that the names of files with filter errors get indexed anyway
This commit is contained in:
parent
46a7f05cbc
commit
e1584c2e21
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.64 2007-12-13 06:58:21 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.65 2007-12-20 09:08:04 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -418,24 +418,40 @@ DbIndexer::processone(const std::string &fn, const struct stat *stp,
|
|||||||
FileInterner::Status fis = FileInterner::FIAgain;
|
FileInterner::Status fis = FileInterner::FIAgain;
|
||||||
bool hadNullIpath = false;
|
bool hadNullIpath = false;
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
|
const string plus = "+";
|
||||||
char ascdate[20];
|
char ascdate[20];
|
||||||
sprintf(ascdate, "%ld", long(stp->st_mtime));
|
sprintf(ascdate, "%ld", long(stp->st_mtime));
|
||||||
while (fis == FileInterner::FIAgain) {
|
while (fis == FileInterner::FIAgain) {
|
||||||
doc.erase();
|
doc.erase();
|
||||||
|
|
||||||
string ipath;
|
string ipath;
|
||||||
fis = interner.internfile(doc, ipath);
|
fis = interner.internfile(doc, ipath);
|
||||||
if (fis == FileInterner::FIError) {
|
if (fis == FileInterner::FIError) {
|
||||||
list<string> ext = interner.getMissingExternal();
|
list<string> ext = interner.getMissingExternal();
|
||||||
m_missingExternal.merge(ext);
|
m_missingExternal.merge(ext);
|
||||||
m_missingExternal.unique();
|
m_missingExternal.unique();
|
||||||
// We dont stop indexing for one bad doc
|
// We used to return at this point.
|
||||||
return FsTreeWalker::FtwOk;
|
//
|
||||||
}
|
// The nice side was that if a filter failed because of a
|
||||||
|
// lacking supporting app, the file would be indexed once
|
||||||
|
// the app was installed.
|
||||||
|
//
|
||||||
|
// The not so nice point was that the file name was not
|
||||||
|
// indexed.
|
||||||
|
//
|
||||||
|
// We now index at least the file name. We use a dirty
|
||||||
|
// hack to ensure that the indexing will be retried each
|
||||||
|
// time: the stored number as decimal ascii mtime is
|
||||||
|
// prefixed with a '+', which doesnt change its value for
|
||||||
|
// atoll() but is tested by rcldb::needUpdate()
|
||||||
|
// Reset the date as set by the handler if any
|
||||||
|
doc.fmtime.erase();
|
||||||
|
// Go through:
|
||||||
|
}
|
||||||
|
|
||||||
// Set the date if this was not done in the document handler
|
|
||||||
if (doc.fmtime.empty()) {
|
if (doc.fmtime.empty()) {
|
||||||
doc.fmtime = ascdate;
|
// Set the date if this was not done in the document handler
|
||||||
|
doc.fmtime = (fis == FileInterner::FIError) ? plus + ascdate :
|
||||||
|
ascdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal access path for multi-document files
|
// Internal access path for multi-document files
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.129 2007-12-13 06:58:21 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.130 2007-12-20 09:08:04 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -1237,7 +1237,9 @@ bool Db::needUpdate(const string &filename, const struct stat *stp)
|
|||||||
cp+= 6;
|
cp+= 6;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
time_t mtime = cp ? atoll(cp) : 0;
|
// If the time string begins with a "+", force an update. Happens
|
||||||
|
// after a filter error, see indexer.cpp, processone()
|
||||||
|
time_t mtime = (!cp || *cp == '+') ? 0 : atoll(cp);
|
||||||
|
|
||||||
// Retrieve file size as stored in db data
|
// Retrieve file size as stored in db data
|
||||||
cp = strstr(data.c_str(), "fbytes=");
|
cp = strstr(data.c_str(), "fbytes=");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user