title: how to delete documents using term in lucene
body: <p>I am trying to delete a document by using a term in lucene index. but the code that I made below isn't working. are there any suggestion of how can I perform deleting function in lucene index?</p>
  
  <pre><code>public class DocumentDelete {
  public static void main(String[] args) {
  File indexDir = new File("C:/Users/Raden/Documents/lucene/LuceneHibernate/adi");
  Term term = new Term(FIELD_PATH, "compatible");
  Directory directory = FSDirectory.getDirectory(indexDir);
  IndexReader indexReader = IndexReader.open(directory);
  indexReader.deleteDocuments(term);
  indexReader.close();        
  }
  }
  </code></pre>