Thanks Andi,
I'm on Ubuntu 6.06.
After a few days of playing w/ this, I think i've
almost got the hooks working. I actually added a few
functions to existing classes, but i'm having trouble
w/ one. I added the following function to
IndexSearcher.java:
public void setDocSizes(int[] docSizes)
--- begin unnecessary info ----
This function is a way for me to pass in a big array
where the index is the doc_id, and the resulting
integer is the number of terms in that document....
its a long story but i use it in my custom doc
collector (also written in java now). yes .... its
beginning to look like a hack job.
--- end unnecessary info ---
But really, i'm just having a hard time w/ the glue
code in lucene.cpp for this particular API addition.
I currently have the following:
static void
*j_indexsearcher_setDocSizes(j_indexsearcher *self,
PyObject *arg)
{
jintArray docSizes;
if (!parseArg(arg, "K", &JArray<jint>::class$,
&docSizes))
{
OBJ_CALL(self->object->setDocSizes(docSizes));
Py_RETURN_NONE;
}
return PyErr_SetArgsError((PyObject *) self,
"setDocSizes", arg);
}
In particular, this line is killing me:
if (!parseArg(arg, "K", &JArray<jint>::class$,
&docSizes))
I can't find a letter to match an int array, so i just
went w/ K (and also tried a ton of permutations on
what you see above), but obviously, I also don't know
parseArg works very well in general. Any help w/ this
line would be really appreciated.
I do have the function declarations (at the top of
lucene.cpp) setup correctly i believe (except still
some confusion on declaring functions METH_VARARGS vs
METH_O).
Any help is greatly appreciated. I'm really getting
an understanding of how tedious it is to make these
two languages sing in harmony. You've clearly put an
extraordinary amount of effort into this -- thank you.
J
--- Andi Vajda <[EMAIL PROTECTED]> wrote:
>
> On Mon, 3 Sep 2007, John Kleven wrote:
>
> > I have a sinking feeling that writing this in Java
> and
> > then writing the hooks for PyLucene is going to be
> my
> > only solution. I have attempted just compiling
> > PyLucene from scratch in the past .... and have
> failed
> > miserably. Any new docs/info/wiki entries on
> > compilation/hooks?
>
> Nothing new, really. What OS are you on ?
>
> If you're using gcj 4.x you need to start from .java
> files and use a JDK
> other than gcj itself for the .java compilation part
> as is done, for example,
> here [1]. Unless you're on Intel Mac or need some
> recent libgcj fixes (such as
> support for index files larger than 2gb), sticking
> with gcj 3.4.x is easiest.
>
> As for adding extension hooks, it's easiest to
> copy/paste/modify existing
> hooks. See how the HitCollector is done. Look for
> strings
> containing 'PythonHitCollector', in the java and cpp
> dirs, in Makefile and in
> lucene.cpp.
>
> Andi..
>
> [1]
>
http://lists.osafoundation.org/pipermail/pylucene-dev/2006-November/001404.html
> _______________________________________________
> pylucene-dev mailing list
> [email protected]
>
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
>
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev