From 45fccb2e387b2c0b74d6376e62001ac84450ae3e Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sat, 30 Aug 2014 10:37:52 -0600 Subject: [PATCH 1/2] + bool Manager::setBookIndex(const string id, const string path) --- src/common/kiwix/manager.cpp | 4 ++++ src/common/kiwix/manager.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/common/kiwix/manager.cpp b/src/common/kiwix/manager.cpp index bf2726d41..45e1c282d 100644 --- a/src/common/kiwix/manager.cpp +++ b/src/common/kiwix/manager.cpp @@ -427,6 +427,10 @@ namespace kiwix { return false; } + bool Manager::setBookIndex(const string id, const string path) { + return this->setBookIndex(id, path, XAPIAN); + } + bool Manager::setBookPath(const string id, const string path) { std::vector::iterator itr; for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) { diff --git a/src/common/kiwix/manager.h b/src/common/kiwix/manager.h index 6190a1c65..453ba9054 100644 --- a/src/common/kiwix/manager.h +++ b/src/common/kiwix/manager.h @@ -54,6 +54,7 @@ namespace kiwix { bool setCurrentBookId(const string id); string getCurrentBookId(); bool setBookIndex(const string id, const string path, const supportedIndexType type); + bool setBookIndex(const string id, const string path); bool setBookPath(const string id, const string path); string addBookFromPathAndGetId(const string pathToOpen, const string pathToSave = "", const string url = "", const bool checkMetaData = false); From c1a8b4a206ededc645fe60c305912f5c3f0b319d Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sun, 31 Aug 2014 19:27:23 -0600 Subject: [PATCH 2/2] + small optim --- src/common/kiwix/indexer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/kiwix/indexer.cpp b/src/common/kiwix/indexer.cpp index 0092bc8d0..69e244643 100644 --- a/src/common/kiwix/indexer.cpp +++ b/src/common/kiwix/indexer.cpp @@ -24,13 +24,16 @@ namespace kiwix { /* Count word */ unsigned int Indexer::countWords(const string &text) { unsigned int numWords = 1; - for(unsigned int i=0; i