I am using Lucene 4.6. I created a Lucene IndexWriter(in CREATE MODE) and added documents and committed it(didnt close it). Then ran a search query and stored the results. Again I added documents to the index writer and committed it and closed it. And ran a search query on it. It gave results with new data and old data also. The old data was also present in the index. May i know the way to delete all the data from the index. Is there any way to delete all the documents at a stretch?
1
votes
2 Answers
1
votes
That would be better if you could provide us the code snippet, but it seems the issue is you are using OpenMode.CREATE
instead of OpenMode.CREATE_OR_APPEND
. In that case, each time you create the IndexWriter
object, the old data is overritten, not appended.
Also, make sure you are using the latest version. The current is v4.9.0