In order to use a thread other than the main thread with PyLucene you need to
create it as an instance of PyLucene.PythonThread because libgcj, the gcj java
runtime, insists on needing to create and initialize that thread.
See the ThreadIndexFiles.py PyLucene sample.
With twisted you need to, somehow, ensure that the threads it creates are
created via PyLucene.PythonThread. There may be some thread factory hooks
there you can reuse, I'm not too knowledgeable about twisted...
http://www.mail-archive.com/[email protected]/msg00245.html
Andi..
On Sun, 9 Oct 2005, Chris (FeedTagger) wrote:
Is there a better way to do this or a work around for this lag on the
first search query?
You may want to ask [email protected], the Lucene user mailing list,
where you can get expert advice on Lucene usage issues.
Thanks Andi. Further investigation has pointed out that the sort query
on an index builds two sorted arrays. These are then cached in memory
(FieldCache) so further requests using the same sort willl be quick.
The solution to my problem is to use a separate thread to perform a
search before loading the new IndexSearcher into my twisted server. I
tried this (twisted.internet.threads.deferToThread) but it resulted in
a core dump.
Some googling has shown threads with PyLucene and Twisted has been
achieved with Chandler
(http://wiki.osafoundation.org/bin/view/Journal/TedLeung20040827), but
I know little about Chandler and am not particularly keen on adding
bits and pieces of Chandler just to get this working.
Is there a simple solution to have PyLucene and Twisted talk nicely
with threads?
Cheers,
Chris
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev