[Xapian-discuss] Xapian JNI questions

Olly Betts olly at survex.com
Wed Dec 13 04:15:06 GMT 2006


On Mon, Dec 11, 2006 at 03:28:04PM -0500, Eric B. Ridge wrote:
> On Dec 7, 2006, at 1:19 PM, Alex Kushkuley wrote:
> 
> >Yes. I tried
> >
> > ctorid = env->GetMethodID(documentclass, "<init>", "(J)V");
> >
> >in opertor()  function of JavaMatchDecider in  java/native/Enquire.cc
> >
> >and that worked!
> 
> Unless I misunderstand what you changed, that's not the RightThing to  
> do here.  Calling the void ctor for Document will create a new, empty  
> Document object, which severely limits your MatchDecider's ability to  
> make decisions!

Wouldn't the "void ctor" for Document be something like this:

    ctorid = env->GetMethodID(documentclass, "<init>", "(V)");

The change Alex is talking about above is adding a void *return value*
to the function signature - i.e. changing "(J)" to "(J)V".

I just checked the example I added to the SmokeTest, and the document
passed to the MatchDecider has the correct document data, so it's not
creating a new empty Document object.

But perhaps this isn't portable to other java implementations (I seem to
be using Sun's javac 1.5.0_08 and GNU gij 4.1.2 - no idea why I have a
mixed java toolchain installed!)  I can change this if there's something
better, but I want to make sure we aren't talking at cross-purposes.

Cheers,
    Olly



More information about the Xapian-discuss mailing list