I think you forgot to commit your changes in IndexWriter or have not closed it before creating Searcher/IndexReader. So on the second run, the index is seen, because of the previous run, which was committed on jvm exit.
If you are using NearRealtimeSearch (IndexWriter#getIndexReader), please tell as its different here. ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Paulo Avelar [mailto:phave...@gmail.com] > Sent: Monday, March 15, 2010 9:15 AM > To: java-user@lucene.apache.org > Subject: issue querying index. > > Hello, > > I'm using the latest Lucene 3.0.1. > > I have written a simple test, which does the usual, creates an index, > then add 2 tests documents to it. > > I'm having a strange problem, first time I run my test, which runs a > query I get nothing. > but the second time I run my test (exactly the same code) , the query > wild results. > > Any idea what could be causing this? I'm going crazy trying to > figure this out. > > I noticed the index segments_ file is incremented the second time I > run the test to 3. (segments_3) > > > Any help is very much appreciated. > > Thank you, > > Paul > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org