code: public void process(IntermediateForm form) throws IOException {
      // first delete
      Iterator<Term> iter = form.deleteTermIterator();
      while (iter.hasNext()) {
        writer.deleteDocuments(iter.next());
      }
      // then insert
      writer.addIndexesNoOptimize(new Directory[] { form.getDirectory() });
      numForms++;
    }
docs: Process an intermediate form by carrying out, on the Lucene instance of
  the shard, the deletes and the inserts (a ram index) in the form.
  @param form  the intermediate form containing deletes and a ram index
  @throws IOException