Hi All, I am using Lucene 3.1 in the project.
*Background for the question:* I am working on the application which starts with 2 threads, one performs indexing activity and other performs searching activity (I create searcher object from reader object). Both these threads run periodically and index or search new documents if they are available. My searcher searches a string in the lucene index using a BooleanQuery with SHOULD clause. *Problem:* My problem is as follows: As I see there are 2 ways to create indexReader (to create searcher) A. indexWriter.getReader() --> to get near real time searching or B. Using directly the index directory path like indexReader = IndexReader.open(NIOFSDirectory.open(new File(DIR_PATH)), true) Now when the application starts, since there is no index created yet if I use option "B" to create indexReader, I fail with IndexNotFoundException. If I create IndexReader using option "A", I dont fail with exception but do not get any result for my input which is ok since I dont have searchable index yet. My problem is, with option "A" of creating reader object, even after indexing say 1000 documents and I still dont match any result. (The index does have matching results. I can say that for sure because if I stop my application, change the code to create reader using option B and then search the same string on the newly created index of 1000 documents, I get lot of matches.). I am missing something due to which I am not getting any match for option A? What am I doing wrong? thanks Saurabh