title: Updating lucene index - the most popular way
body: <p>I am updating lucene index onec a day. My strategy in general is:</p>
  
  <ol>
  <li>Find all objects in DB that was modified since last index generation.</li>
  <li>Create new tmp-index for these objects. (old index is stil available)</li>
  <li>Remove all new indexed Documents (they are in tmp-index) from the old index using IndexWriter.deleteDocuments(Term)</li>
  <li>Merge old index and tmp-index using IndexWriter.addIndexes(...)</li>
  </ol>
  
  <p>I have found that in lucene wiki: <a href="http://wiki.apache.org/lucene-java/LuceneFAQ#How_do_I_update_a_document_or_a_set_of_documents_that_are_already_indexed.3F" rel="nofollow">There is no direct update procedure in Lucene...</a>
  I have found also that in lucene 4.1.0 doc: <a href="http://lucene.apache.org/core/4_1_0/core/index.html" rel="nofollow">A document can be updated with updateDocument...</a></p>
  
  <p>I have tried IndexWriter.updateDocument(Term, Document) but then performing search with filter I got NPE from one of my methods what not happens when I update index as describe in 1-4. Have anyone had a similar problem? How do you update your index? </p>