On Mon, 9 Jan 2006, tsuraan wrote:
Have you considered using a Reader instead of passing a large string ?
The Field class has a reader interface.
How would I do that from Python? I really know nothing about the Java
APIs, but I assume you're thinking of making a FileReader and giving
that to the Field class. If I wrote something inheriting from Reader
within Python, I'd still get the issue of transferring large strings
from python to java, right? I'll look at how Reader is exposed in the
swig interface; maybe sending FileReader through that interface would
be best. Thanks for the direction, anyhow :)
It's quite simple. Create a class with two methods, read() and close() and
pass an instance to the Field.Text() constructor.
For an example reader class, see
http://svn.osafoundation.org/pylucene/trunk/test/Streams.py
then, for an example using it, see line 112 of
http://svn.osafoundation.org/pylucene/trunk/test/test_PyLucene.py
From earlier debugging, it seems that Lucene will invoke read() in blocks of
about 2k. If you have enough for a 2k unicode string on your stack, you should
be safe.
I hope to get to a proper fix tomorrow or the day after.
Andi..
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev