3
0
Fork 0

Merge pull request #274 from kiwix/embedded_zim_support

Add support of embedded ft-index in zim for kiwix-serve and kiwix-search.
small_fixes
Kelson 10 years ago committed by GitHub
commit 493c8cb95e

@ -602,17 +602,20 @@ int main(int argc, char **argv) {
string humanReadableId = currentBook.getHumanReadableIdFromPath(); string humanReadableId = currentBook.getHumanReadableIdFromPath();
readers[humanReadableId] = reader; readers[humanReadableId] = reader;
/* Instanciate the ZIM index (if necessary) */ /* Try to instanciate the zim index.
if (!indexPath.empty()) { * If there is no specified indexPath, try to open the
try { * embedded index in the zim. */
kiwix::Searcher *searcher = new kiwix::XapianSearcher(indexPath); if (indexPath.empty()) {
searcher->setProtocolPrefix("/"); indexPath = zimPath;
searcher->setSearchProtocolPrefix("/search?"); }
searcher->setContentHumanReadableId(humanReadableId); try {
searchers[humanReadableId] = searcher; kiwix::Searcher *searcher = new kiwix::XapianSearcher(indexPath);
} catch (...) { searcher->setProtocolPrefix("/");
cerr << "Unable to open the search index '" << indexPath << "'." << endl; searcher->setSearchProtocolPrefix("/search?");
} searcher->setContentHumanReadableId(humanReadableId);
searchers[humanReadableId] = searcher;
} catch (...) {
cerr << "Unable to open the search index '" << indexPath << "'." << endl;
} }
} }
} }

Loading…
Cancel
Save