[Xapian-discuss] Xapian JNI questions
Alex Kushkuley
kushkuley at gmail.com
Wed Dec 6 21:21:30 GMT 2006
I am using Xapian JNI layer for a while and I am interested in
status of Xapian JNI, documentation, bug lists, references, etc.
Specifically, is the following correct:
1) Writable database object must be finalized to release writable
database lock (otherwise database could become unreadable if
application is restarted (after crash ) ?
2) finalize method must be called on any Xapian JNI onject when its
no longer needed ?
I have also encountered a few bugs
3) the following function in org.xapian.ESetIterator always returns false.
public boolean hasNext() {
try {
return XapianJNI.esetiterator_equals(id, _end_id);
} catch (XapianError xe) {
throw new XapianRuntimeError(xe);
When changed to
public boolean hasNext() {
try {
return !XapianJNI.esetiterator_equals(id, _end_id);
} catch (XapianError xe) {
throw new XapianRuntimeError(xe);
}
}
it seems to be working correctly.
4) Attempts to use MatchDecider caused an exception:
Exception in thread "Thread-37" java.lang. accept
at org.xapian.XapianJNI.enquire_register_match_decider(Native Method)
at org.xapian.Enquire.registerMatchDecider(Enquire.java:127)
at tv.cozmo.neo.logic.search.YouTubeShowIndexManager.isIndexed(YouTubeShowIndexManager.java:286
The JNI code is as follows:
JavaMatchDecider(JNIEnv *xenv, jclass xclazz, jobject &obj) :
MatchDecider() {
env = xenv;
clazz = xclazz;
_obj = obj;
TRY
_deciderclass = env->GetObjectClass(obj);
if (!_deciderclass) goto on_error;
_acceptmethod = env->GetMethodID(_deciderclass,
"accept", "(Lorg/xapian/Document;)I");
if (!_acceptmethod) goto on_error;
on_error:
CATCH(;)
}
Since the return type for accept method is boolean, I have replaced
"(Lorg/xapian/Document;)I" with "(Lorg/xapian/Document;)Z" ( and the
same for JavaExpandDecider ).
With this change the NoSuchMethodError exception is no longer thrown,
however, it looks like
the JavaMatchDecider is not called at all.
Regards & Thanks,
Alex Kushkuley
More information about the Xapian-discuss
mailing list