mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-23 03:52:35 -04:00
+ new indexer code
This commit is contained in:
parent
5726006d5b
commit
31b3308937
@ -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
|
||||
|
@ -23,7 +23,7 @@
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <kiwix/cluceneIndexer.h>
|
||||
//#include <kiwix/cluceneIndexer.h>
|
||||
#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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user