I have a basic search engine,(used lucene) which searches for text in documents (.txt) given in the directory. I need help how to update the indexes of modified/deleted documents.
If I understand your added comment, you want to watch your directory of .txt files, then only re-index the files that changed. There are some classes in the java.nio.file package that should help.
Here is an overview: http://docs.oracle.com/javase/tutorial/essential/io/notification.html#overview.