Skip to content

Commit 1dd170b

Browse files
committed
Add missing implementation of Searcher setNativeSearcherMulti
1 parent 6fd7849 commit 1dd170b

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

lib/src/main/cpp/libzim/searcher.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,23 @@ METHOD(void, setNativeSearcher, jobject archive)
4747
}
4848
}
4949

50-
50+
METHOD(void, setNativeSearcherMulti, jobjectArray archives)
51+
{
52+
std::vector<zim::Archive> cArchives;
53+
jsize nbArchives = env->GetArrayLength(archives);
54+
for(int i=0; i<nbArchives; i++) {
55+
jobject archive = env->GetObjectArrayElement(archives, i);
56+
auto cArchive = getPtr<zim::Archive>(env, archive);
57+
cArchives.push_back(*cArchive);
58+
}
59+
try {
60+
auto searcher = std::make_shared<zim::Searcher>(cArchives);
61+
SET_PTR(searcher);
62+
} catch (std::exception& e) {
63+
LOG("Cannot create searcher");
64+
LOG("%s", e.what());
65+
}
66+
}
5167

5268
DISPOSE
5369

0 commit comments

Comments
 (0)