[pylucene-dev] pylucene and pylons

TJ Ninneman tj at twopeasinabucket.com
Fri Apr 11 08:55:17 PDT 2008


I'm sure someone can shed some light on this for you but I'm a strong  
believer in separating the front end web app and any backend search/ 
indexing services (just like we separate the front end webapp from the  
backend database (mysql, pgsql, etc).

Our Pylons app simply queries a backend XML-RPC instance which can be  
threaded, forking, single threaded, twisted or whatever.  Let me just  
say it's a lot easier debugging concurrency issues in a a simple XML- 
RPC server than in Apache, Paste Http, CherryPy, etc.

TJ

On Apr 11, 2008, at 10:47 AM, John Beaver wrote:

> 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
> pylucene-dev at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylucene-dev



More information about the pylucene-dev mailing list