From 1dd170bd597ae03d2cfe38e7d63565748c08c266 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 24 Jan 2023 15:56:01 +0100 Subject: [PATCH] Add missing implementation of Searcher setNativeSearcherMulti --- lib/src/main/cpp/libzim/searcher.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/src/main/cpp/libzim/searcher.cpp b/lib/src/main/cpp/libzim/searcher.cpp index eaaff98..cbad5c3 100644 --- a/lib/src/main/cpp/libzim/searcher.cpp +++ b/lib/src/main/cpp/libzim/searcher.cpp @@ -47,7 +47,23 @@ METHOD(void, setNativeSearcher, jobject archive) } } - +METHOD(void, setNativeSearcherMulti, jobjectArray archives) +{ + std::vector cArchives; + jsize nbArchives = env->GetArrayLength(archives); + for(int i=0; iGetObjectArrayElement(archives, i); + auto cArchive = getPtr(env, archive); + cArchives.push_back(*cArchive); + } + try { + auto searcher = std::make_shared(cArchives); + SET_PTR(searcher); + } catch (std::exception& e) { + LOG("Cannot create searcher"); + LOG("%s", e.what()); + } +} DISPOSE