lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neha Gupta <>
Subject initVM() crash and
Date Mon, 15 Jun 2009 19:12:57 GMT

I have a very simple webserver that I set up using See the simplest
example here:

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:

*class search:
  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 =*

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
this post:<>
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.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message