On Wed, 21 May 2008, TJ Ninneman wrote:
For some reason it seems the Document.getFields() method returns a List of
fields that are not of the type Field. As you'll see below, they don't have
the same type or attributes:
doc = lucene.Document()
field = lucene.Field("myfield", lucene.StringReader("mystring"))
field
<Field: indexed,tokenized<myfield:[EMAIL PROTECTED]>>
field.name()
u'myfield'
doc.add(field)
fields = doc.getFields()
fields.get(0)
<Object: indexed,tokenized<myfield:[EMAIL PROTECTED]>>
Java declares a List to contain instances of Object. Until Lucene makes use
of Java 1.5 feature, such as generics, and declares this list a List<Field>,
there is nothing JCC can do, automatically, to determine what the intended
wrapper class should be.
For this, there is a cast_() Class method defined on all classes exported
by JCC to cast anything permitted to an instance of the class it is called
from. See line 119 of [1]. See sample code for many examples of use.
Andi..
[1] http://svn.osafoundation.org/pylucene/trunk/jcc/README
_______________________________________________
pylucene-dev mailing list
pylucene-dev@osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev