mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-24 04:20:56 -04:00
Adapt to new kiwix-lib search API.
This commit is contained in:
parent
d94423964e
commit
f12a731939
@ -80,13 +80,21 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* Try to prepare the indexing */
|
/* Try to prepare the indexing */
|
||||||
try {
|
try {
|
||||||
/* We will not get the snippets, So we do not need to pass the reader */
|
|
||||||
reader = new kiwix::Reader(zimPath);
|
reader = new kiwix::Reader(zimPath);
|
||||||
searcher = new kiwix::Searcher(reader);
|
} catch (...) {
|
||||||
|
/* Cannot open the zimPath, maybe it is a plain old xapian database directory */
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( reader ) {
|
||||||
|
searcher = new kiwix::Searcher("", reader);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
searcher = new kiwix::Searcher(zimPath, NULL);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
cerr << "Unable to search through zim '" << zimPath << "'." << endl;
|
cerr << "Unable to search through zim '" << zimPath << "'." << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Start the indexing */
|
/* Start the indexing */
|
||||||
if (searcher != NULL) {
|
if (searcher != NULL) {
|
||||||
|
@ -856,7 +856,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (!indexPath.empty()) {
|
if (!indexPath.empty()) {
|
||||||
try {
|
try {
|
||||||
kiwix::Searcher *searcher = new kiwix::Searcher(reader);
|
kiwix::Searcher *searcher = new kiwix::Searcher(indexPath, reader);
|
||||||
searcher->setProtocolPrefix("/");
|
searcher->setProtocolPrefix("/");
|
||||||
searcher->setSearchProtocolPrefix("/search?");
|
searcher->setSearchProtocolPrefix("/search?");
|
||||||
searcher->setContentHumanReadableId(humanReadableId);
|
searcher->setContentHumanReadableId(humanReadableId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user