Hi, I'm trying to integrate PyLucene with a Pylons app, but I'm having serious stability problems. Does anyone have experience with this?

Specifically, I have a single action which does the following:

lucene.initVM(lucene.CLASSPATH)
directory = FSDirectory.getDirectory(Globals.LUCENE_INDEX_PATH);
searcher = IndexSearcher(directory)
analyzer = StandardAnalyzer()
query = QueryParser('terms', analyzer).parse(term)
hits = searcher.search(query)
... process hits

It works perfectly the first time I view the corresponding webpage, but it reproducibly crashes the webserver (paster serve) the second time I try, always while in the initVM() function.

I've tried putting the initVM() call in middleware.py, and I've tried using a global flag to make sure that initVM() is only called once in the controller. Both seem to fail when a different thread tries to access PyLucene functions.

I'm assuming this is a threading issue, so I'm going to write some code to ensure that everything happens within a single thread. But does anyone have a simpler solution for getting this working within Pylons?
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to