lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <>
Subject Re: Pylucene
Date Fri, 27 Feb 2009 19:52:02 GMT

On Fri, 27 Feb 2009, Bill Janssen wrote:

> Andi Vajda <> wrote:
>> I changed the 'Type' suffix used to name Python types to '$$Type'.
>> neo4j now lets itself be wrapped. Fixed in rev 748053.
> Andi, thanks for this.
> Though it brings up another matter :-).
> neo4j has this funky RelationshipType usage, too.  RelationshipType is
> an interface, and you instantiate classes that implement that interface
> to create distinct relationship types (thus the name).  So I had to
> write some Java code to allow me to write Python classes for this
> purpose -- a Java Python-extension class which implements
> RelationshipType.  But the example on the neo4j page does it a bit
> differently, using a Java enum:
> enum MyRelationshipTypes implements RelationshipType
> {
> }
> This presumably creates a set of instances (KNOWS and FORGETS), each of
> which is a MyRelationshipTypes.  Is there any alternative mapping of
> this kind of thing via JCC to the Python world?

At this point, JCC does not support any of the new language features 
introduced in Java 1.5 such as generics. Unless I'm mistaken (Java 1.5 is 
not so new anymore and I forget which is what), enums were also introduced 

Why not support these Java 1.5 features ? Well, JCC's needs were originally 
driven by PyLucene's and until Java Lucene starts using Java 1.5 features, I 
didn't feel it high priority to implement support for them.
Java Lucene is still not using Java 1.5 features. I believe this is slated 
for release 3.0 which is still some way off.

Maybe it's time to add support for these features in JCC regardless. It's 
been years...

This would also solve the problem you were having with the PythonSet 
implementation earlier since being able to use it as PythonSet<String> would 
help it work a lot better.

How do you workaround this with the current JCC features ? At this point, I 
don't know what an enum is turned into from a Java reflection's perspective 
but I seem to remember that all these Java 1.5 features were implemented in 
terms of earlier (pre-Java 1.5) building blocks. This would seem to indicate 
that your enums may be found as instances of some auto-generated class, for 
example ?

To find out, add your custom Java code (with these enums) to your build and 
see what gets generated for them. Maybe there is a way then to use them from 
Python (don't forget to mark it public too, otherwise JCC is going to 
ignore it anyway).


View raw message