diff --git a/src/manager/kiwix-manage.cpp b/src/manager/kiwix-manage.cpp index 06461af..d407726 100644 --- a/src/manager/kiwix-manage.cpp +++ b/src/manager/kiwix-manage.cpp @@ -44,7 +44,6 @@ void show(kiwix::Library* library) std::cout << "#" << inc++ << std::endl << "id:\t\t" << book.getId() << std::endl << "path:\t\t" << book.getPath() << std::endl - << "indexpath:\t" << book.getIndexPath() << std::endl << "url:\t\t" << book.getUrl() << std::endl << "title:\t\t" << book.getTitle() << std::endl << "name:\t\t" << book.getName() << std::endl @@ -64,7 +63,7 @@ void usage() cerr << "Usage:" << endl; cerr << "\tkiwix-manage LIBRARY_PATH add ZIM_PATH " "[--zimPathToSave=../content/foobar.zim] [--current] " - "[--indexPath=FULLTEXT_IDX_PATH] [--url=http://...metalink]" + "[--url=http://...metalink]" << endl; cerr << "\tkiwix-manage LIBRARY_PATH show [CONTENTID1] [CONTENTID2] ... " "(show everything if no param.)" @@ -85,7 +84,6 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath, { string zimPath; string zimPathToSave = "."; - string indexPath; string url; string origID = ""; int option_index = 0; @@ -102,11 +100,10 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath, static struct option long_options[] = {{"url", required_argument, 0, 'u'}, {"origId", required_argument, 0, 'o'}, - {"indexPath", required_argument, 0, 'i'}, {"zimPathToSave", required_argument, 0, 'z'}, {0, 0, 0, 0}}; - c = getopt_long(argc, argv, "cz:u:i:", long_options, &option_index); + c = getopt_long(argc, argv, "cz:u:", long_options, &option_index); if (c != -1) { switch (c) { @@ -118,10 +115,6 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath, origID = optarg; break; - case 'i': - indexPath = optarg; - break; - case 'z': zimPathToSave = optarg; break; @@ -134,21 +127,7 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath, if (!zimPath.empty()) { kiwix::Manager manager(library); zimPathToSave = zimPathToSave == "." ? zimPath : zimPathToSave; - string bookId = manager.addBookFromPathAndGetId( - zimPath, zimPathToSave, url, false); - if (!bookId.empty()) { - /* Save the index infos if necessary */ - if (!indexPath.empty()) { - if (isRelativePath(indexPath)) { - indexPath = computeAbsolutePath(indexPath, getCurrentDirectory()); - } - library->getBookById(bookId).setIndexPath(indexPath); - } - } else { - cerr << "Unable to build or save library file '" << libraryPath << "'" - << endl; - resultCode = 1; - } + manager.addBookFromPathAndGetId(zimPath, zimPathToSave, url, false); } else { std::cerr << "Invalid zim file path" << std::endl; resultCode = 1; diff --git a/src/searcher/kiwix-search.cpp b/src/searcher/kiwix-search.cpp index b6fac3b..97129f8 100644 --- a/src/searcher/kiwix-search.cpp +++ b/src/searcher/kiwix-search.cpp @@ -27,8 +27,7 @@ void usage() { cout << "Usage: kiwix-search [OPTIONS] ZIM PATTERN" << endl << endl << " kiwix-search allows to find articles based on the a fulltext search pattern." << endl << endl - << " ZIM is the full path of the ZIM file. This can also be a disctinct fulltext" << endl - << " index directory (usually distributed with the *.idx extension)." << endl + << " ZIM is the full path of the ZIM file." << endl << " PATTERN is/are word(s) - or part of - to search in the ZIM." << endl << endl << " -s, --suggestion\tSuggest article titles based on the few letters of the PATTERN instead of making a fulltext search. Work a bit like a completion solution." << endl << " -v, --verbose\t\tGive details about the search process" << endl; @@ -102,12 +101,8 @@ int main(int argc, char** argv) searcher = new kiwix::Searcher(); searcher->add_reader(reader, ""); } else { - try { - searcher = new kiwix::Searcher(zimPath, NULL, ""); - } catch (...) { - cerr << "Unable to search through zim '" << zimPath << "'." << endl; - exit(1); - } + cerr << "Unable to search through zim '" << zimPath << "'." << endl; + exit(1); } /* Start the indexing */ diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index b54e768..fe5baff 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -914,7 +914,6 @@ int main(int argc, char** argv) struct MHD_Daemon* daemon; vector zimPathes; string libraryPath; - string indexPath; string rootPath; string interface; int serverPort = 80; @@ -930,7 +929,6 @@ int main(int argc, char** argv) {"library", no_argument, 0, 'l'}, {"nolibrarybutton", no_argument, 0, 'm'}, {"nosearchbar", no_argument, 0, 'n'}, - {"index", required_argument, 0, 'i'}, {"attachToProcess", required_argument, 0, 'a'}, {"port", required_argument, 0, 'p'}, {"interface", required_argument, 0, 'f'}, @@ -942,7 +940,7 @@ int main(int argc, char** argv) while (true) { int option_index = 0; int c - = getopt_long(argc, argv, "mndvli:a:p:f:t:r:", long_options, &option_index); + = getopt_long(argc, argv, "mndvla:p:f:t:r:", long_options, &option_index); if (c != -1) { switch (c) { @@ -961,9 +959,6 @@ int main(int argc, char** argv) case 'm': noLibraryButtonFlag = true; break; - case 'i': - indexPath = optarg; - break; case 'p': serverPort = atoi(optarg); break; @@ -1024,11 +1019,6 @@ int main(int argc, char** argv) exit(1); } - if ((zimPathes.size() > 1) && !indexPath.empty()) { - cerr << "You cannot set a indexPath if you also set several zimPathes"; - exit(1); - } - /* Setup the library manager and get the list of books */ kiwix::Manager manager(&library); if (libraryFlag) { @@ -1071,12 +1061,6 @@ int main(int argc, char** argv) exit(1); } } - if (!indexPath.empty()) { - if (isRelativePath(indexPath)) { - indexPath = computeAbsolutePath(indexPath, getCurrentDirectory()); - } - library.getBookById(library.getBooksIds()[0]).setIndexPath(indexPath); - } } /* Instance the readers and searcher and build the corresponding maps */ @@ -1087,7 +1071,6 @@ int main(int argc, char** argv) for (auto& bookId: booksIds) { auto& currentBook = library.getBookById(bookId); auto zimPath = currentBook.getPath(); - auto indexPath = currentBook.getIndexPath(); /* Instanciate the ZIM file handler */ kiwix::Reader* reader = NULL; @@ -1108,17 +1091,6 @@ int main(int argc, char** argv) searcher->add_reader(reader, humanReadableId); globalSearcher->add_reader(reader, humanReadableId); searchers[humanReadableId] = searcher; - } else if ( !indexPath.empty() ) { - try { - kiwix::Searcher* searcher = new kiwix::Searcher(indexPath, reader, humanReadableId); - searcher->setProtocolPrefix(rootLocation + "/"); - searcher->setSearchProtocolPrefix(rootLocation + "/" + "search?"); - searchers[humanReadableId] = searcher; - } catch (...) { - cerr << "Unable to open the search index '" << indexPath << "'." - << endl; - searchers[humanReadableId] = nullptr; - } } else { searchers[humanReadableId] = nullptr; }