System.out.println("Indexing " + f.getAbsolutePath()); Document doc = new Document(); doc.add(new Field("contents",loadContents (doc),Field.Store.NO,Field.Index.TOKENIZED)); doc.add(new Field("filename", f.getAbsolutePath(),Field.Store.YES,Field.Index.TOKENIZED)); writer.addDocument(doc);
Hi Chris, Do you open the writer to add your "update" to before you close the indexreader to delete the outdated index document? Another question comes in mind, do you open a new IndexReader for your searches after the update was written to the index? You have to follow these steps: 1. Add you document 2. close writer 3. open reader 4. delete the outdated stuff 5. close reader 6. open writer 7. add the update 8. close writer 9. release new searcher / reader hope that gives you a little help. best regards simon