mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 11:22:38 -04:00
+ 2nd regression fix
This commit is contained in:
parent
0ae076b5ad
commit
417749a3fc
@ -416,6 +416,29 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* Instanciate the ZIM index (if necessary) */
|
/* Instanciate the ZIM index (if necessary) */
|
||||||
if (indexPath != "") {
|
if (indexPath != "") {
|
||||||
|
|
||||||
|
/* Try with the XapianSearcher */
|
||||||
|
try {
|
||||||
|
searcher = new kiwix::XapianSearcher(indexPath);
|
||||||
|
hasSearchIndex = true;
|
||||||
|
} catch (...) {
|
||||||
|
cerr << "Unable to open the search index '" << zimPath << "' with the XapianSearcher." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try with the CluceneSearcher */
|
||||||
|
if (!hasSearchIndex) {
|
||||||
|
try {
|
||||||
|
searcher = new kiwix::CluceneSearcher(indexPath);
|
||||||
|
hasSearchIndex = true;
|
||||||
|
} catch (...) {
|
||||||
|
cerr << "Unable to open the search index '" << zimPath << "' with the CluceneSearcher." << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* searcher configuration */
|
||||||
|
if (hasSearchIndex) {
|
||||||
|
|
||||||
/* Change the current dir to binary dir */
|
/* Change the current dir to binary dir */
|
||||||
/* Non portable linux solution */
|
/* Non portable linux solution */
|
||||||
readlink("/proc/self/exe", rootPath, PATH_MAX);
|
readlink("/proc/self/exe", rootPath, PATH_MAX);
|
||||||
@ -444,28 +467,9 @@ int main(int argc, char **argv) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try with the XapianSearcher */
|
|
||||||
try {
|
|
||||||
searcher = new kiwix::XapianSearcher(indexPath);
|
|
||||||
hasSearchIndex = true;
|
|
||||||
} catch (...) {
|
|
||||||
cerr << "Unable to open the search index '" << zimPath << "' with the XapianSearcher." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try with the CluceneSearcher */
|
|
||||||
if (!hasSearchIndex) {
|
|
||||||
try {
|
|
||||||
searcher = new kiwix::CluceneSearcher(indexPath);
|
|
||||||
hasSearchIndex = true;
|
|
||||||
} catch (...) {
|
|
||||||
cerr << "Unable to open the search index '" << zimPath << "' with the CluceneSearcher." << endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* searcher configuration */
|
|
||||||
searcher->setProtocolPrefix("/");
|
searcher->setProtocolPrefix("/");
|
||||||
searcher->setSearchProtocolPrefix("/search?");
|
searcher->setSearchProtocolPrefix("/search?");
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
hasSearchIndex = false;
|
hasSearchIndex = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user