On Wed, 12 May 2010, Andi Vajda wrote:

Christian Heimes, Dirk Rothe, and I have jcc-wrapped bobo-browse (http://code.google.com/p/bobo-browse/) in order to add faceted search capabilities to PyLucene. However, the two modules don't play well together, as wrappers from PyLucene cannot be used in a bobo-browse context and vice versa. What is the best way to get classes from two different jcc python extension modules to interact?

I've noticed that when there is overlap in Java classes between two JCC-built extensions, these kinds of errors occur. One can imagine that if the classes have the same name but are not from the same codebase that funny version conflicts might arise, for example.

But I haven't looked into exactly what the problem is but a simple workaround is to just create one extension that combines both Lucene and Bobo-browse. Take the JCC invocation for PyLucene from its Makefile and add the things would want from Bobo-browse you want from it and you should have something that works better.

Here is an idea that I think should work but I couldn't test it because bobo is built from maven and pylucene isn't.

Basically, the idea is that you must be really careful in not having Lucene classes come from two or more different places:
 1. build pylucene the usual way
 2. build bobo by giving it the lucene jar files that are inside pylucene's
    lucene egg by setting the classpath accordingly:
    $ CLASSPATH=`python -c 'import lucene; print lucene.CLASSPATH'`
 3. build the bobo extension with jcc using the same classpath and by _not_
    using --jar or --include with any of the lucene jar files already inside
    pylucene's lucene egg, relying solely on the classpath for finding
    lucene classes
 4. Once all is built, you don't need to set any classpath in addition to
    what the initVM() calls are already doing:
    >>> import lucene; lucene.initVM()
    >>> import bobo; bobo.initVM()
    The bobo extension adds its classpath to what lucene's already setup
    and finds the lucene classes there.

Again, I didn't test this because it's too much work to disentangle the bobo build from maven so that I can control where things are coming from.
You understand the bobo build better and can probably try this quicker.

Please let me know if this works for you.
Thanks !

Andi..

Reply via email to