Add missing implementation of Searcher setNativeSearcherMulti

This commit is contained in:
Matthieu Gautier 2023-01-24 15:56:01 +01:00
parent 6fd7849241
commit 1dd170bd59

View File

@ -47,7 +47,23 @@ METHOD(void, setNativeSearcher, jobject archive)
}
}
METHOD(void, setNativeSearcherMulti, jobjectArray archives)
{
std::vector<zim::Archive> cArchives;
jsize nbArchives = env->GetArrayLength(archives);
for(int i=0; i<nbArchives; i++) {
jobject archive = env->GetObjectArrayElement(archives, i);
auto cArchive = getPtr<zim::Archive>(env, archive);
cArchives.push_back(*cArchive);
}
try {
auto searcher = std::make_shared<zim::Searcher>(cArchives);
SET_PTR(searcher);
} catch (std::exception& e) {
LOG("Cannot create searcher");
LOG("%s", e.what());
}
}
DISPOSE