[pylucene-dev] initVM() crash and web.py
gupta.neha at gmail.com
Mon Jun 15 11:04:52 PDT 2009
I have a very simple webserver that I set up using web.py. See the simplest
The only change that I have above is that I also have a /search url that is
handled using "class search" which just searches an index and prints out
the hits. The code for that is also taken from pylucene tutorial:
def GET(self, urlParams=None):
lucene.initVM(lucene.CLASSPATH) # Where should this be called, perhaps
not on every request?
if not (os.path.exists(indexDir) and os.path.isdir(indexDir)):
return "Invalid Path to Index"
# Second argument being false indicates that we want to open an existing
# and not construct a new one.
fsDir = FSDirectory.getDirectory(indexDir, False)
searcher = IndexSearcher(fsDir)
# Switch parsing to use AND, so use an instance of QueryParser rather
# the static parse method.
parser = QueryParser("contents", StandardAnalyzer())
query = parser.parse("some query")
hits = searcher.search(query)*
The problem am having is that when I send a few requests one after the other
then the server crashes. I tried to put initVM() right after import lucene
statement at the top of the program but the crash still happens. I also read
The problem seems familiar to mine, however, am not sure where should I put
initVM(). Should I also be calling env.attachCurrentThread() somewhere?
I am very new to pylucene, any help would be great.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pylucene-dev