title: How to keep Lucene index synchronized with Mysql database?
body: <p>I am trying to utilize Lucene to develop full text search in my application, which need to build index based on my mysql database. I was wondering is how to keep these index synchronized with db?
  I came up with to ways:
  1) add extra code in business logic tightly to update the search index .
  2) running a separated task to rebuild the index periodically.</p>
  
  <p>do you have any other approaches? and what do you think is the best way?
  Any comments would be appreciate, thanks in advance!</p>