3
0
Fork 0

Update to new kiwix-lib API about Searcher instantiation.

`kiwix-lib` remove `setContentHumanReadableId` method in favour of
specifying directly it in the constructor.
better_search_tool
Matthieu Gautier 8 years ago
parent 7776eafbfc
commit 0cfcc59437

@ -86,10 +86,11 @@ int main(int argc, char** argv)
} }
if (reader) { if (reader) {
searcher = new kiwix::Searcher("", reader); searcher = new kiwix::Searcher();
searcher->add_reader(reader, "");
} else { } else {
try { try {
searcher = new kiwix::Searcher(zimPath, NULL); 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);

@ -949,10 +949,9 @@ int main(int argc, char** argv)
searchers[humanReadableId] = searcher; searchers[humanReadableId] = searcher;
} else if ( !indexPath.empty() ) { } else if ( !indexPath.empty() ) {
try { try {
kiwix::Searcher* searcher = new kiwix::Searcher(indexPath, reader); kiwix::Searcher* searcher = new kiwix::Searcher(indexPath, reader, humanReadableId);
searcher->setProtocolPrefix("/"); searcher->setProtocolPrefix("/");
searcher->setSearchProtocolPrefix("/search?"); searcher->setSearchProtocolPrefix("/search?");
searcher->setContentHumanReadableId(humanReadableId);
searchers[humanReadableId] = searcher; searchers[humanReadableId] = searcher;
} catch (...) { } catch (...) {
cerr << "Unable to open the search index '" << indexPath << "'." cerr << "Unable to open the search index '" << indexPath << "'."

Loading…
Cancel
Save