From 31b330893715e7ca1e9f80daf4f7d7fba1a6855f Mon Sep 17 00:00:00 2001 From: kelson42 Date: Fri, 6 Apr 2012 21:48:43 +0000 Subject: [PATCH] + new indexer code --- src/indexer/Makefile.am.orig | 6 ++---- src/indexer/kiwix-index.cpp | 11 ++++++----- src/installer/kiwix-install.cpp | 5 ++++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/indexer/Makefile.am.orig b/src/indexer/Makefile.am.orig index f9397aa..3787a36 100644 --- a/src/indexer/Makefile.am.orig +++ b/src/indexer/Makefile.am.orig @@ -7,8 +7,7 @@ kiwix_index_SOURCES= \ ../common/unaccent.cpp \ ../common/kiwix/indexer.cpp \ ../common/kiwix/reader.cpp \ - ../common/kiwix/xapianIndexer.cpp \ - ../common/kiwix/cluceneIndexer.cpp + ../common/kiwix/xapianIndexer.cpp include_HEADERS= \ ../common/kiwix/xapian/myhtmlparse.h \ ../common/kiwix/xapian/namedentities.h \ @@ -16,8 +15,7 @@ include_HEADERS= \ ../common/unaccent.h \ ../common/kiwix/indexer.h \ ../common/kiwix/reader.h \ - ../common/kiwix/xapianIndexer.h \ - ../common/kiwix/cluceneIndexer.h + ../common/kiwix/xapianIndexer.h kiwix_index_CXXFLAGS=$(LIBXAPIAN_CFLAGS) $(LIBCLUCENE_CFLAGS) $(LIBICU_CFLAGS) $(LIBZIM_CFLAGS) -I../common/ kiwix_index_LDFLAGS=$(LIBXAPIAN_LDFLAGS) $(LIBCLUCENE_LDFLAGS) $(LIBICU_LDFLAGS) $(LIBZIM_LDFLAGS) kiwix_index_LDADD=../zimlib/src/.libs/libzim.a diff --git a/src/indexer/kiwix-index.cpp b/src/indexer/kiwix-index.cpp index f1f402b..656e4ef 100644 --- a/src/indexer/kiwix-index.cpp +++ b/src/indexer/kiwix-index.cpp @@ -23,7 +23,7 @@ #ifdef _WIN32 #include #else -#include +//#include #endif enum supportedBackend { XAPIAN, CLUCENE }; @@ -95,10 +95,10 @@ int main(int argc, char **argv) { try { if (backend == CLUCENE) { #ifndef _WIN32 - indexer = new kiwix::CluceneIndexer(zimFilePath, indexPath); + //indexer = new kiwix::CluceneIndexer(zimFilePath, indexPath); #endif } else { - indexer = new kiwix::XapianIndexer(zimFilePath, indexPath); + indexer = new kiwix::XapianIndexer(); } } catch (...) { cerr << "Unable to index '" << zimFilePath << "'." << endl; @@ -107,11 +107,12 @@ int main(int argc, char **argv) { /* Start the indexing */ if (indexer != NULL) { - indexer->start(); + indexer->start(zimFilePath, indexPath); while (indexer->isRunning()) { + if (verboseFlag) + cout << indexer->getProgression() << "% of all the articles indexed..." << endl; sleep(1); } - //while (indexer->indexNextPercent(verboseFlag)) {}; delete indexer; } else { cerr << "Unable instanciate the Kiwix indexer." << endl; diff --git a/src/installer/kiwix-install.cpp b/src/installer/kiwix-install.cpp index ba773cc..ac1d6f4 100644 --- a/src/installer/kiwix-install.cpp +++ b/src/installer/kiwix-install.cpp @@ -181,7 +181,10 @@ int main(int argc, char **argv) { } if (indexer != NULL) { - while (indexer->indexNextPercent(verboseFlag)) {}; + indexer->start(); + while (indexer->isRunning()) { + sleep(1); + } delete indexer; } else { cerr << "Unable instanciate the Kiwix indexer." << endl;