recollindex builds. Still need to implement quite a lot of ifndefed stuff (pathut, rclconfig)

--HG--
branch : WINDOWSPORT
This commit is contained in:
Jean-Francois Dockes
2015-08-30 15:30:50 +02:00
parent d4cd1dd91c
commit 75517f7497
24 changed files with 344 additions and 59 deletions
+2
View File
@@ -33,8 +33,10 @@ DocFetcher *docFetcherMake(const Rcl::Doc& idoc)
idoc.getmeta(Rcl::Doc::keybcknd, &backend);
if (backend.empty() || !backend.compare("FS")) {
return new FSDocFetcher;
#ifndef DISABLE_WEB_INDEXER
} else if (!backend.compare("BGL")) {
return new BGLDocFetcher;
#endif
} else {
LOGERR(("DocFetcherFactory: unknown backend [%s]\n", backend.c_str()));
return 0;
+10 -5
View File
@@ -14,9 +14,7 @@
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "autoconfig.h"
#endif
#include <stdio.h>
#include <errno.h>
@@ -27,7 +25,9 @@
#include "debuglog.h"
#include "indexer.h"
#include "fsindexer.h"
#ifndef DISABLE_WEB_INDEXER
#include "beaglequeue.h"
#endif
#include "mimehandler.h"
#include "pathut.h"
@@ -46,7 +46,9 @@ ConfIndexer::ConfIndexer(RclConfig *cnf, DbIxStatusUpdater *updfunc)
ConfIndexer::~ConfIndexer()
{
deleteZ(m_fsindexer);
#ifndef DISABLE_WEB_INDEXER
deleteZ(m_beagler);
#endif
}
// Determine if this is likely the first time that the user runs
@@ -107,7 +109,7 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun, int flags)
return false;
}
}
#ifndef DISABLE_WEB_INDEXER
if (m_dobeagle && (typestorun & IxTBeagleQueue)) {
deleteZ(m_beagler);
m_beagler = new BeagleQueueIndexer(m_config, &m_db, m_updater);
@@ -116,7 +118,7 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun, int flags)
return false;
}
}
#endif
if (typestorun == IxTAll) {
// Get rid of all database entries that don't exist in the
// filesystem anymore. Only if all *configured* indexers ran.
@@ -173,6 +175,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
ret = m_fsindexer->indexFiles(myfiles, flag);
LOGDEB2(("ConfIndexer::indexFiles: fsindexer returned %d, "
"%d files remainining\n", ret, myfiles.size()));
#ifndef DISABLE_WEB_INDEXER
if (m_dobeagle && !myfiles.empty() && !(flag & IxFNoWeb)) {
if (!m_beagler)
@@ -183,7 +186,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
ret = false;
}
}
#endif
// The close would be done in our destructor, but we want status here
if (!m_db.close()) {
LOGERR(("ConfIndexer::index: error closing database in %s\n",
@@ -255,6 +258,7 @@ bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
if (m_fsindexer)
ret = m_fsindexer->purgeFiles(myfiles);
#ifndef DISABLE_WEB_INDEXER
if (m_dobeagle && !myfiles.empty() && !(flag & IxFNoWeb)) {
if (!m_beagler)
m_beagler = new BeagleQueueIndexer(m_config, &m_db, m_updater);
@@ -264,6 +268,7 @@ bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
ret = false;
}
}
#endif
// The close would be done in our destructor, but we want status here
if (!m_db.close()) {
+1 -3
View File
@@ -16,20 +16,18 @@
*/
#ifndef _INDEXER_H_INCLUDED_
#define _INDEXER_H_INCLUDED_
#include "rclconfig.h"
#include <string>
#include <list>
#include <map>
#include <vector>
#ifndef NO_NAMESPACES
using std::string;
using std::list;
using std::map;
using std::vector;
#endif
#include "rclconfig.h"
#include "rcldb.h"
#include "rcldoc.h"
#ifdef IDX_THREADS
+2 -1
View File
@@ -142,6 +142,7 @@ string mimetype(const string &fn, const struct stat *stp,
string mtype;
#ifndef _WIN32
// Extended attribute has priority on everything, as per:
// http://freedesktop.org/wiki/CommonExtendedAttributes
if (pxattr::get(fn, "mime_type", &mtype)) {
@@ -152,6 +153,7 @@ string mimetype(const string &fn, const struct stat *stp,
return mtype;
}
}
#endif
if (cfg == 0) {
LOGERR(("Mimetype: null config ??\n"));
@@ -179,7 +181,6 @@ string mimetype(const string &fn, const struct stat *stp,
if (mtype.empty() && stp)
mtype = mimetypefromdata(cfg, fn, usfc);
out:
return mtype;
}
+10 -2
View File
@@ -42,7 +42,9 @@ using namespace std;
#include "x11mon.h"
#include "cancelcheck.h"
#include "rcldb.h"
#ifndef DISABLE_WEB_INDEXER
#include "beaglequeue.h"
#endif
#include "recollindex.h"
#include "fsindexer.h"
#ifndef _WIN32
@@ -135,6 +137,7 @@ class MyUpdater : public DbIxStatusUpdater {
return false;
}
#ifndef DISABLE_X11MON
// If we are in the monitor, we also need to check X11 status
// during the initial indexing pass (else the user could log
// out and the indexing would go on, not good (ie: if the user
@@ -144,7 +147,7 @@ class MyUpdater : public DbIxStatusUpdater {
stopindexing = true;
return false;
}
#endif
return true;
}
@@ -520,9 +523,11 @@ int main(int argc, char **argv)
if (op_flags & OPT_k) {
indexerFlags &= ~ConfIndexer::IxFNoRetryFailed;
} else {
#ifndef _WIN32
if (checkRetryFailed(config, false)) {
indexerFlags &= ~ConfIndexer::IxFNoRetryFailed;
}
#endif
}
Pidfile pidfile(config->getPidfile());
@@ -646,10 +651,12 @@ int main(int argc, char **argv)
"not going into monitor mode\n"));
exit(1);
} else {
#ifndef _WIN32
// Record success of indexing pass with failed files retries.
if (!(indexerFlags & ConfIndexer::IxFNoRetryFailed)) {
checkRetryFailed(config, true);
}
#endif
}
deleteZ(confindexer);
#ifndef _WIN32
@@ -687,11 +694,12 @@ int main(int argc, char **argv)
makeIndexerOrExit(config, inPlaceReset);
bool status = confindexer->index(rezero, ConfIndexer::IxTAll,
indexerFlags);
#ifndef _WIN32
// Record success of indexing pass with failed files retries.
if (status && !(indexerFlags & ConfIndexer::IxFNoRetryFailed)) {
checkRetryFailed(config, true);
}
#endif
if (!status)
cerr << "Indexing failed" << endl;
if (!confindexer->getReason().empty())