Hi, Here is what I am using Lucene.
I build the index (from different data source) during midnight. I build a FSDirectory. Then I load it into RAMDirectory for the best performance. When I built it, I called IndexWriter.optimize() once. Once the index is built, I will never update it. I have static variable defined as IndexSearcher. Once I load RAMDirectory, I do newIndexDirectory = new RAMDirectory(fsDirectory); IndexWriter newWriter = new IndexWriter(newIndexDirectory, new StandardAnalyzer(), true); newWriter.optimize(); newWriter.close(); searcher = new IndexSearcher(newIndexDirectory ); For every new search, I do QueryParser parser = new QueryParser("field1", new StandardAnalyzer()); Query query = parser.parse(queryString); Hits hits = searcher.search(query); Is this the right way? Do I need to close parse, query or hits? As I have only one IndexSearcher, will it cause any problem? I found using the same query does not always give me the same response time. Thanks much. -- View this message in context: http://www.nabble.com/Is-this-the-right-way-to-use-Lucene-in-multithread-env--tp17150728p17150728.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]